ABSTRACT This paper presents an enhanced approach for grid-connected photovoltaic (PV) systems using a flyback converter and Sovereign Butterfly Optimization for advanced Maximum Power Point Tracking (MPPT). The focus is on improving energy extraction efficiency from PV panels by dynamically adjusting system parameters. A flyback converter ensures reliable grid integration, while the Butterfly Optimization Algorithm, inspired by butterfly foraging, provides real-time MPPT to rapidly and accurately track the maximum power point, even under varying environmental conditions. A novel voltage harmonic mitigation technique processes three-phase currents through dq0 frames for closed-loop control, reducing harmonics and optimising voltage precision. The DC/DC flyback converter stabilizes AC conversion, minimizing high-frequency harmonics. Additionally, a Subsystem Synchronization Control Strategy synchronizes active and non-active grid currents, improving system stability. Simulations show a 99.3% tracking accuracy, 2% power oscillation around the maximum power point, and a Total Harmonic Distortion (THD) of 1.78%, meeting IEC 61,727 standards.