By optimising the growth temperature of the AlGaN layers and using high-temperature AlN buffer layers, high-quality AlxGa1 – xN layers (x = 0.15, 0.21, 0.26, and 0.3) were obtained, in which stimulated emission in the UV spectral range 330 – 297 nm was implemented with the threshold intensity of excitation Ith ≈ 0.7 – 1.4 MW cm−2, respectively. It is found that the threshold value of the stimulated emission of AlGaN layers grown by molecular beam epitaxy is largely determined by the intensity of the process of thermal decomposition of GaN, which affects the surface morphology and, consequently, the amount of optical scattering loss. It is shown that no pronounced localisation of nonequilibrium charge carriers occurs in the AlGaN layers, which is manifested in the absence of a large Stokes shift and in the realisation of optical amplification at transitions in an electron-hole plasma, and also indicates a relatively homogeneous material composition.