Due to the intermittent nature of weather conditions, the integration of power electronics for renewable energy sources (RES), like photovoltaic (PV) systems, and the variability in power demand, effective energy management strategies are essential. Battery Energy Storage (BES) helps maintain stability and balance within the microgrid (MG) under changing conditions. A PV-Series Active Power Filter (APF) improves power quality (PQ) by addressing these challenges. This study presents a comprehensive approach within a PV-battery MG system. The Enhanced Perturb and Observe (EP&O) Maximum Power Point Tracking (MPPT), algorithm shows superior stability, robustness, and accuracy in tracking the Maximum Power Point (MPP) compared to the incremental conductance (INC) and basic P&O methods. Additionally, the proposed Energy Management System (EMS) optimizes power distribution between PV, BES, and the grid, ensuring efficient load demand management. The PV-Series APF effectively mitigates PQ issues such as unbalanced, sags, swells voltages, and harmonics. It reduces Total Harmonic Distortion (THD) to between 0.67 % and 0.7 %. Simulation results confirm the effectiveness of these integrated solutions in enhancing EMS and PQ within the MG.