In this paper, we propose a distributed controller for voltage regulation in islanded ac microgrids with lossy electrical lines. The stability analysis presented takes into account the controller in charge of regulating the frequency in the microgrid, i.e., we do not assume decoupled operation of the proposed voltage controller and the frequency controller. We show that the frequency controller achieves active power load sharing by driving the power flows to a certain manifold, while the voltage controller moves along this manifold and adjusts the voltage magnitudes at the inverter buses to maintain a healthy voltage profile throughout the microgrid, i.e., voltage magnitudes at all buses are within some prescribed limits. Since achieving voltage regulation and reactive power sharing are known to be conflicting objectives, in this paper, we pursue the voltage regulation objective. However, reactive power sharing can be recovered to some extent by tuning a certain parameter in the voltage controller.