A new method proposed to enhance the optical confinement of the terahertz band in a vertical cavity surface emitting laser involves introducing a square-lattice photonic crystal structure. This structure’s filling factor was optimized by computing the energy band structure and optical band values of the photonic crystal. The optimal optical band value is 0.436–0.528 a/λ. At a specific carrier concentration, the real part of dielectric constant of GaAs/AlGaAs materials will gradually increase with the increase of Al elements. By adjusting the length of the resonant cavity, a vertical cavity surface emitting laser with two wavelengths can be created without utilizing current injection. Additionally, the photonic crystal structure’s control effect on the transverse mode of the vertical cavity surface emitting laser and the release effect of the PN junction light confinement were analyzed. Numerical calculations indicated that incorporating a cubic photonic crystal structure in the vertical cavity surface emitting laser resulted in a 2× increase in the difference frequency intensity and a 6.33× increase in the optical field intensity.