Microgrids can be assumed as a solution model for green energy sources, energy storage systems, and combined heat and power (CHP) systems. In this work, the cost and emission minimization based on a demand response (DR) program is considered an optimization problem. To solve the mentioned problem a new multiobjective optimization algorithm (improved particle swarm optimization) is proposed based on a fuzzy mechanism to select the optimal value. The microgrid system includes two CHP units, fuel cell and battery systems, and the heat buffer tank. In this problem, two different feasible operating regions have been assumed in CHPs. Accordingly, to decrease the operational cost, time‐of‐use, and real‐time pricing DR programs have been simulated, and the impacts of the mentioned models are evaluated overload profiles. The effectiveness of proposed models has been applied on different cases studies by different scenarios. The proposed model solved the DR program, time of use‐DR and real‐time pricing‐DR problems. The proposed model could reduce the cost about 10%.