Harmonics are regarded as one of the main challenges in a microgrid. This issue may even get worse when different distributed generators (DGs) work together to solve the load sharing problems due to mismatched feeder impedances and diversified DG ratings. Even though load sharing can be achieved, the microgrid suffers from voltage unbalance and total harmonic distortion (THD) issues at the output of DG terminals as well as at the point of common coupling (PCC). Thus, in this paper, the power quality improving method is discussed, with a target of load sharing under the hierarchical control of different DG units and an active power filter (APF) in microgrids. To achieve this objective, we propose integrating a direct harmonic voltage controlled APF with DGs to improve their harmonic compensation performance. This proposed control scheme has many advantages over conventional control using a shunt resistive active power filter (R-APF) with voltage controlled DGs. First, based on the existing THD level of the PCC voltage, the proposed scheme provides improved voltage compensation and reduction in THD in the islanded microgrid. Secondly, equal load sharing can be achieved simultaneously. Thus, the proposed scheme provides better performance and a seamless interface as the proposed study mainly contains both the voltage controlled DGs and the local based voltage detection APF.