Electron-phonon scattering rates and intersubband optical gain spectra were calculated, including the optical phonon confinement effect in AlGaAs/GaAs/AlGaAs quantum well heterostructures. Comparison of the calculated gain spectra with those calculated using the bulk phonon approximation shows that details of the phonon spectrum have a strong influence on the intersubband optical gain.