This paper establishes the mathematical model of microgrid optimization, aiming at the comprehensive optimization of economics and environmental protection for microgrid day-ahead dispatch while taking into account the aging problem of energy storage. In addition, an incentive-based demand response scheme that considers both renewable energy consumption and consumer satisfaction is proposed. An improved agent particle swarm optimization algorithm is used to solve the model. The effectiveness of the proposed optimization model and solution algorithm is verified by simulation. Impacts of the proposed demand response strategy on microgrid dispatching are also examined.