Recently, the ability of microgrids (μgs) to allow a deeper penetration of Distributed Energy Resources (DERs) in Distribution Networks (DNs) has facilitated their widely spread deployment. Because of the variability associated with the loads and the intrinsic intermittent and nature of renewable energy resources, the development and implementation of effective voltage control strategies is essential to reliably serve the loads, in particular when working islanded from the main grid. To face this problem, we propose a dispersed control approach capable to maintain voltage levels within the operational limits by means of DERs reactive and active power support. We implement an optimization framework to prove the robustness of the proposed control methodology. We illustrate the effectiveness of the proposed methodology with a set of representative studies from the testing of the simulation approach we performed, proving the absence of any opportunity cost involved by the control action.