In recent years, power quality has become a major concern for electric network managers. Active filtering control schemes ensure improved power quality of the electric network and are able to maintain a desired voltage level at the point of connection, regardless of the current absorbed by nonlinear loads. Harmonics can cause vibrations, equipment distortion, losses and sweatiness in transformers. The main objective of this work is to enhance the quality of energy in a microgrid consisting of 100 kW photovoltaic (PV) system and a 50 kW battery storage connected to nonlinear and unbalanced loads. This paper proposes a the four-arm parallel active filter with a on Proportional-Integral (PI) controller to mitigate the harmonic problems in a microgrid. In addition, an algorithm has been designed to eliminate the neutral current. The identification function is one of the most particular approach for extracting harmonics, it involves providing a current reference imposed by the active filter in order to carry out the filtering operation. Both the performance and the quality of the current harmonic compensation's depend strongly on the strategy adopted for the generating the current reference. In this work, the instantaneous power strategy p-q is chosen outstanding the simplicity and effectiveness in implementation. The proposed control strategy has been tested under simulations and the results have shown good tracking of the references and a significant reduction in the Total Harmonic Distorsion (THD) level under highly unbalanced conditions of the nonlinear loads. The current THD is reduced from 43.64 before filtering to 3.74% after the application of the four-arm filter, following the recommendations of IEEE-519 standard (THD less than 5%).