In this study, the effect of temperature difference between the layers of a unimorph piezoelectric energy harvester was modeled and solved analytically. For modeling, a clamped beam with a two-layer configuration (including the active layer of PZT-5H piezoelectric and the homogeneous layer of aluminum) was used. Transverse base vibrations applied to the harvester beam and temperature changes will lead to mechanical strain in the piezoelectric layer. With the coupling of electrical and mechanical equations, and by assuming constant heat transfer in the layers of the harvesting beam, the governing equations were solved. The change in the thickness of the harvesting beam layers, the harvested electric power density, and the current, voltage, and deflection created at different temperatures were investigated. Obtained numerical results showed that the performance of the harvester at the investigated temperatures is very different. The highest power density was obtained at 80 °C and when the thickness of the homogeneous layer was twice that of the piezoelectric layer. Numerical results showed that in the best case, temperature changes can cause an increase of more than 80% of the generated voltage and 98% of the harvested power, which is considered a significant change in the performance of the harvester.