A novel and accurate physics-informed neural network method for solving differential equations, called the Extreme Theory of Functional Connections (or XTFC), is employed to solve optimal control problems. The proposed method is utilized in solving the system of differential equations resulting from the indirect method formulation of the optimal control problem, derived from the Hamiltonian function and applying the Pontryagin Maximum/Minimum Principle (PMP). The system of differential equations makes up the first order necessary conditions of the states and costates which in general produces a boundary value problem (BVPs) that is solved via X-TFC. According to the Theory of Functional Connections, the latent solutions are approximated with particular expansions, called constrained expressions. A constrained expression is a functional that both always satisfies the specified constraints and has a free-function that does not affect the specified constraints. In the X-TFC formulation, the free-function is a single-layer NN, or more precisely, an Extreme Learning Machine (ELM). Using ELMs, the unknown coefficients appear linearly and therefore, a least-square approach (for linear problems) or an iterative least-square approach (for non-linear problems) is used to compute the unknowns by minimizing the residual of the system of differential equations. In this work, the approach is validated by solving the Feldbaum problem and optimal orbit transfer problems. It is shown the major benefit of this method is the low computational time along with comparable accuracy with respect to the state of the art methods.