In this paper, an adaptive neuro-fuzzy based on fractional-order proportional-integral-derivative (ANFFOPID) controller with an improved slime mould algorithm (ISMA) for the two-legged robot (TLR) is proposed to achieve the minimum angular displacement error of the joint motors. Achieving such error is considered a challenging and time-consuming process due to the gain values set for the FOPID controller. Thus the neural-fuzzy network is used to provide the FOPID input signals by the adaptive magnitude gains. The adaptive mechanism depends on the ISMA to train the neural network weights. The outstanding properties of the ANFFOPID controller are evaluated by comparing the proposed controller with other existing work that is modified chaotic invasive weed optimization based on neural network (MCIWO-NN) for various walking terrains that are flat surface, stair ascending, and stair descending. Finally, the results obtained show the effectiveness of the ANFFOPID controller.