To address the operational challenges of in-pipe robots in large pipes of water distribution systems (WDS), in this research, a control algorithm is proposed for our previously designed robot . Our size adaptable robot has an under-actuated modular design that can be used for both leak detection and quality monitoring. First, nonlinear dynamical governing equations of the robot are derived with the definition of two perpendicular planes and two sets of states are defined for the robot for stabilization and mobilization. For stabilization, we calculated the auxiliary system matrices and designed a stabilizer controller based on the linear quadratic regulator (LQR) controller, and combined it with a proportional-integral-derivative (PID) based controller for mobilization. The controller scheme is validated with simulation in MATLAB in various operation conditions in three iterations. The simulation results show that the controller can stabilize the robot inside the pipe by converging the stabilizing states to zero and keeping them in zero with initial values between -25° and +25° and tracking velocities of 10cm/s, 30cm/s, and 50cm/s which makes the robot agile and dexterous for operation in pipelines.