Growing application of distributed generation units at remote places has led to the evolution of microgrid (MG) technology. When an MG system functions independently, i.e., in autonomous mode, unpredictable loads and uncertainties emerge throughout the system. To obtain stable and flexible operation of an autonomous MG, a rigid control mechanism is needed. In this paper, a robust high-performance controller is introduced to improve the performance of voltage tracking of an MG system and to eliminate stability problems. A combination of a resonant controller and a lead-lag compensator in a positive position feedback path is designed, one which obeys the negative imaginary (NI) theorem, for both single-phase and three-phase autonomous MG systems. The controller has excellent tracking performance. This is investigated through considering various uncertainties with different load dynamics. The feasibility and effectiveness of the controller are also determined with a comparative analysis with some well-known controllers, such as linear quadratic regulator, model predictive and NI approached resonant controllers. This confirms the superiority of the designed controller.