Nonlinear gain coefficients due to the effects of carrier heating are derived from the rate equations of carrier energy transfer in semiconductor lasers. We find that, in the modulation responses of semiconductor lasers, stimulated recombination heating will affect the resonant frequency and damping rate in a same form as the effects of spectral hole burning, while free carrier absorption heating will only affect the damping rate. The effects of injection heating and nonstimulated recombination heating are also discussed. The carrier energy relaxation time is calculated from first principles by considering the interactions between carriers and polar optical phonons, deformation potential optical phonons, deformation potential acoustic phonons, piezoelectric acoustic phonons. At the same time, the hot phonon effects associated with the optical phonons are evaluated because their negligible group velocity and finite decay time. We show that the carrier-polar longitudinal optical phonon interaction is the major channel of carrier energy relaxation processes for both electron and holes. We also point out the importance of the longitudinal optical phonon lifetime in evaluating the carrier energy relaxation time. Neglecting the finite decay time of longitudinal optical phonons will significantly underestimate the carrier energy relaxation time, this not only contradicts the experimental results but also severely underestimates the nonlinear gain coefficients due to carrier heating. The effects of spectral hole burning, stimulated recombination heating, and free carrier absorption heating on limiting the modulation bandwidth in semiconductor lasers are also discussed.