DC-DC converters are used in applications such as renewable energy electronic systems, dc motor drives, charge controller for battery, etc. In the proposed method, the Proportional-Integral-Derivative (PID) controller is applied to a Buck-boost converter operating in Continuous Conduction Mode (CCM). Since machine learning is becoming increasingly important in all fields of engineering and technology, and Genetic Algorithms (GAs) have a wide range of applications in machine learning and optimization problems, the proposed method employs a GA for the optimization of DC-DC converter control parameters. The GA is used in determining the optimized parameters for PID controller and Integral of Absolute Error (IAE) is considered as the object function to minimize the estimated error. The optimization of the PID controller is performed using MATLAB Simulink software. In the simulations, the output performance parameters such as rise time, overshoot, settling time, steady-state error are estimated and overshoot of output voltage for various source and load transient conditions are analyzed to determine the performance of the proposed system. The effectiveness of the controller has been tested in both Buck and Boost mode of operations through simulation experiments. The developed GA optimized PID has shown good performance both in steady-state and transient conditions.