This paper presents a nonlinear distributed controller design for islanded operation of microgrids in order to maintain active and reactive power balance. In this paper, the microgrids are considered as inverter-dominated networks integrated with renewable energy sources (RESs) and battery energy storage systems (BESSs) where solar photovoltaic (PV) generators act as RESs and plug-in hybrid electric vehicles (PHEVs) as BESSs to supply power into the grid. The detail dynamic models of PV generators and BESSs are also developed in this paper. The proposed distributed control scheme gathers information from local and neighboring generators to achieve the desired control objectives. The proposed controller is designed by using feedback linearization and the communication between generators and control centers is developed by using the concept of graph theory. Finally the performance of the proposed controller is demonstrated on a test microgrid and simulation results indicate the superiority under different operating conditions as compared to a linear quadratic regulator (LQR)-based controller.