To ensure enhanced reliability and availability of electricity to consumers, grid-connected photovoltaic systems need to improve their power quality, this paper uses a three-phase five levels cascaded H-bridge inverter in grid-connected mode to improve the flexibility and efficiency of the photovoltaic system. Each photovoltaic (PV) array in the proposed system has a maximum power point tracker (MPPT) to extract the PV array maximum power point for a particular irradiance and temperature and reduce the mismatch that causes an imbalance in the power sent from the inverter to the main grid. The fuzzy logic controller is used to tune the proportional-integral (PI) controller to regulate the current and voltage of the grid-connected inverter by changing the gain of the PI controller (Kp, Ki) to obtain a fast response and improve the power quality of the system despite different load disturbances and inputs. The system was simulated in MATLAB/Simulink, and the results show the superiority of the proposed control unit, in which a pure and stable sine output voltage and current waveforms. Finally, the total harmonic distortion (THD) is improved to reach 3.81% based on the fuzzy PI controller, while 7.77% is based on the PI controller.