In this paper, a PEM fuel cell including burner, steam reformer, and water heater for domestic application has been considered. Water is used for cooling of the fuel cell. Cold water is passed through a cooling channel, warmed up and used for domestic water heating. To increase the efficiency, outlet steam of fuel cell is fed to the reformer. The perfomance of the system is optimized by exergy analysis based on the second law of thermodynamics. Also, the effect of burner, fuel cell temperature and stoichiometric air fuel ratio are investigated. In this analysis, pressure loss in the fuel cell and heat transfer of the cooling channel are taken into account whereas, pressure loss in burner and reformer are neglected. Results show, to minimize the entropy generation, fuel cell temperature must be increased to maximize PEM fuel cell temperature. Also, burner and reformer temperature and stoichiometric air fuel ratio must be decreased to , and , respectively.