A microgrid integrated with Distributed Energy Resources (DERs), Energy Storage, and Controllable Loads along with critical and non-critical loads is considered. The operation and maintenance cost (O&M) optimization is performed by the Economic Dispatch using the Reduced Gradient Method in the grid connected mode of microgrid. The minimized cost function of the system must be obtained for the optimization of the O&M cost of microgrid while meeting the load demand. The O&M cost includes the operation and maintenance cost of generated energy by each source and also the energy purchased from the utility. For obtaining the minimum cost of the system, the reduced gradient algorithm is implemented. To improve the reliability and to enhance the economic dispatch operation, a diesel generator and a battery energy storage are included in the microgrid. Different scenarios of the energy sources are compared along with the change in wind and battery profiles of microgrid to obtain the minimum O&M cost of the system. Various profiles of battery and wind energy are considered and minimal O&M cost of each profile is obtained and compared. As a result, the optimal cost of the system is obtained by considering the change in wind and battery profiles and hence provides the optimal solution while meeting the critical and non-critical loads demand.