Ammonia and plasma‐assisted (PA) molecular beam epitaxy modes are used to grow AlN and AlGaN epitaxial layers on sapphire substrates. It is determined that the increase in the thickness of the AlN buffer layer grown by ammonia molecular beam epitaxy (MBE) from 0.32 to 1.25 μm results in the narrowing of 101 X‐Ray rocking curves (XRCs), whereas no clear effect on the 002 XRC width is observed. It is shown that strong GaN decomposition during growth by ammonia MBE causes AlGaN surface roughening and compositional inhomogeneity, which leads to deterioration of its lasing properties. AlGaN layers grown by ammonia MBE at an optimized temperature demonstrate stimulated emission (SE) which peaks at λ = 330, 323, 303, and 297 nm, with SE threshold values of 0.7, 1.1, 1.4, and 1.4 MW cm−2, respectively. In comparison with these, AlGaN layers grown using PA MBE pulsed modes (migration‐enhanced epitaxy, metal‐modulated epitaxy, and droplet elimination by thermal annealing) show SE with a relatively low threshold (0.8 MW cm−2) at a considerably shorter wavelength of λ = 267 nm.