Using different types of renewable energy sources considering their uncertainties causes numerous challenges for minimizing the operation cost and maximizing the reliability of system. Hence, stochastic programming is an essential tool to consider the system uncertainties. This paper presents a day-ahead energy management system to decrease the operation cost and increase the reliability of a Microgrid considering a number of challenges for supporting electrical and thermal loads. In the proposed method, micro-CHP units, renewable energy sources, auxiliary boiler and energy storage system are all responsible for supplying the electrical and thermal loads. The problem is formulated as a multi-objective optimization problem. Moreover, the influence of considering the electrical energy storage system as a non-ideal battery with charge/discharge efficiency less than 1 is investigated. Also, demand response programs are provided based on load shifting contracts to consumers. A scenario-based approach is used to cover the uncertainties of renewable energy sources, market price and electrical load. Besides, this paper considers both islanding and grid-connected modes of Microgrid and investigates the influence of demand side management on operation cost and reliability in both modes. The capability of the proposed algorithm is analyzed by simulation results of a 3-feeder Microgrid.