The two-wheeled self-balancing robot (TWSBR) is based on the axletree and inverted pendulum. Its balancing problem requires a control action. To speed up the response of the robot and minimize the steady state error, in this article, a grey wolf optimizer (GWO) method is proposed for TWSBR control based on state space feedback control technique. The controller stabilizes the balancing robot and minimizes the overshoot value of the system. The dynamic model of the system is derived based on Euler formula and linearized to state space representation to enhance the control technique. Then, the GWO optimizes the state feedback controller parameters. Simulation results show that the system reaches the zero steady-state error with less than 2 ms, which proves the effectiveness of the proposed controller over the classical state feedback controller in terms of fast response, very small overall error, and minimum overshoot.