<span>This paper proposes a new optimal operation of Microgrids (MGs) in a distribution system with wind energy generators (WEGs), solar photovoltaic (PV) energy systems, battery energy storage (BES) systems, electric vehicles (EVs) and demand response (DR). To reduce the fluctuations of wind, solar PV powers and load demands, the BES systems and DR are utilized in the proposed hybrid system. The detailed modeling of WEGs, solar PV units, load demands, BES systems and EVs has been presented in this paper. The objective considered here is the minimization of total operating cost of microgrid, and it is formulated by considering the cost of power exchange between the main power grid and microgrid, cost of wind and solar PV energy systems, cost of BES systems, EVs and the cost due to the DR in the system. Simulations are performed on a test microgrid, and they are implemented using GAMS software. Various case studies are performed with and without considering the proposed hybrid system.</span>