Combined heat and power (CHP) microgrid has the characteristics of high energy utilization rate, flexible operation, and reliable energy supply mode, which make it an important means to realize the transformation of energy production and consumption. The coupling relation of heat and electricity in the CHP microgrid brings adverse effects to the flexibility and economy of the system operation. Therefore, this paper proposes a method for the operation optimization the CHP microgrid based on the integrated demand response (IDR). The IDR includes the thermal load response and the electrical load response, which provides extra optimization space for the thermal and electrical production of the CHP microgrid. The thermal load response is based on the thermal model of the buildings, and the equation between the heating power and the indoor temperature is established. The electrical load response includes the transferable load. Based on the IDR, a mixed integer linear programming (MILP) model is established to optimize the operation of the CHP microgrid, which is then solved by the CPLEX software. The results of the case study show that the application of the IDR enhances the flexibility of the heat and power production of the CHP microgrid, and brings considerable economic benefits to the system operation.