Combined heat and power (CHP) based on proton exchange membrane fuel cells (PEMFCs) is a high-efficiency hydrogen-energy-utilization technique. However, because of the complex coupling between the dynamic demand and supply of energy, the operation of PEMFC-CHP needs to be optimized. Here, a residential PEMFCCHP system is established and its operation is optimized by performing dynamic simulations of the system. The system performance is evaluated based on the matching degree, system efficiency, energy-saving coefficient, environmental coefficient, and fluctuation degree. Various operating modes are considered, namely constant mode, electrical-led mode, rectangular electrical-led mode, ladder mode, and optimal mode. The electrical efficiency under the ladder mode is higher than that of the constant mode. The electrical efficiency under the electrical-led mode is higher than the rectangular electrical-led mode, while the corresponding fluctuation degree is higher. The optimal mode based on the electrical demand is proposed to balance the performance of the system.