In this paper, optimal control of a 3PRS robot is performed, and its related optimal path is extracted accordingly. This robot is a kind of parallel spatial robot with six DOFs which can be controlled using three active prismatic joints and three passive rotary ones. Carrying a load between two initial and final positions is the main application of this robot. Therefore, extracting the optimal path is a valuable study for maximizing the load capacity of the robot. First of all, the complete kinematic and kinetic modeling of the robot is extracted to control and optimize the robot. As the robot is categorized as a constrained robot, its kinematics is studied using a Jacobian matrix and its pseudo inverse whereas its kinetics is studied using Lagrange multipliers. The robot is then controlled using feedforward term of the inverse dynamics. Afterward, the extracted dynamics equation of the robot is transferred to state space to be employed for calculus of variations. Considering the constrained entity of the robot, null space of the robot is employed to eliminate the Lagrange multipliers to provide the applicability of indirect variation algorithm for the robot. As a result, not only are the optimal controlling signals calculated but also the corresponding optimal path of the robot between two boundary conditions is extracted. All the modeling, controlling, and optimization process are verified using MATLAB simulation. The profiles are then double-checked by comparing the results with SimMechanics. It is proved that with the aid of the proposed controlling and optimization method of this article, the robot can be controlled along its optimal path through which the maximum load can be carried.