In this paper a novel direct adaptive fuzzy system is proposed to control flexible-joints robot including actuator dynamics. The design includes two interior loops: the inner loop controls the motor position using proposed approach while the outer loop controls the joint angle of the robot using a PID control law. One novelty of this paper is the use of a PSO algorithm for optimizing the control design parameters to achieve a desired performance. It is worthy of note that to form control law by considering practical considerations just the available feedbacks are used. It is beneficial for industrial applications where
the real-time computation is costly. The proposed control approach has a fast response with a good tracking performance under the well-behaved control efforts. The stability is guaranteed in the presence of both structured and unstructured uncertainties. As a result, all system states are remained bounded. Simulation results on a two-link flexible-joint robot show the efficiency of the proposed scheme.