Renewable and distributed energy generation includes wind turbines, fuel cells, solar cells, and batteries. These distributed energy sources need special power converters in order to connect them to the grid and make the generated power available for public use. Solar energy is the most readily available energy source; hence, if utilized properly, it can power up both domestic and industrial loads. Solar cells produce DC power, and this should be converted to an AC source with the help of inverters. A multi-level inverter for an application is selected based on a trade-off between cost, complexity, losses, and total harmonic distortion (THD). A packed U-cell (PUC) topology is composed of power switches and voltage sources connected in a series-parallel fashion. This basic unit can be extended to a greater number of output voltage levels. The significance of this design is the reduced use of power switches, gate drivers, protection circuits, and capacitors. The converter presented in this paper is a 31-level topology switched by a variable switching frequency-based model predictive controller that helps in achieving optimal output with reduced harmonics to a great extent. The gate driver circuit is also optimized in terms of power consumption and size complexity. A comparison of the 9-level and the 31-level PUC inverters is carried out to study the impact of the number of levels on the total harmonic distortion. The simulation results depict that the total harmonic distortion (THD) for a nominal modulation index of 0.8 is 11.54% and 3.27% for the 9-level multi-level inverter (MLI) and the 31-level modified packed U-cell multi-level inverter (MPUC-MLI), respectively. The reduction in THD is attributed to the increased number of steps in the output when using the model predictive controller.