There is increasing utilization of photovoltaic (PV) grid-connected systems in modern power networks. Currently, PV grid-connected systems utilize transformerless inverters that have the advantages of being low cost, low weight, a small size, and highly efficient. Unfortunately, these inverters have an earth leakage current problem due to the absence of galvanic isolation. This phenomenon represents safety and electrical problems for those systems. Recently, the H8 transformerless inverter was introduced to eliminate the earth leakage current. The present study proposes improving the performance of an H8 transformerless inverter using model predictive control (MPC). The inverter was supplied by PV energy and attached to the grid through an LCL filter. During system modeling, the grid weakness was identified. The discrete model of the overall system, including the PV panel, the boost converter, the H8 transformerless inverter, and the controllers, was derived. Then, the introduced H8 transformerless inverter system was simulated and analyzed by the Matlab/Simulink program. The proposed system response using MPC was tested under step disturbances in the PV insolation level. Moreover, the effect of the weak and strong grid operations was considered. The simulation results indicate that the MPC controller has better performance and high-quality injected power. Despite the excellent performance of the strong grid, the nearly weak grid performance is acceptable. Moreover, the Hardware-in-the-Loop (HIL) of the proposed system was implemented using the DSP target LaunchPadXLTMS320F28379D kit to validate the simulation results. Finally, the system performance under the parameter variations showed good robustness.