Three dimensional (3D) and two dimensional (2D) alternation growth was used to grow AlN epitaxial layers on sapphire substrates. AlN samples grown using this technique have higher crystalline quality and lower dislocation density than samples grown using only 3D or 2D growth modes as witnessed by the high-resolution X-ray diffraction. Smooth atomic terraces with root mean square roughness of 0.107nm were observed using atomic force microscopy (AFM) when the 3D and 2D AlN were 75nm and 425nm, respectively. This sample possesses single crystallographic orientation along the c-axis identified by Raman spectroscopy. Furthermore, the 3D/2D alternating growth mode modulates internal stress in AlN epitaxial layer by adjusting 2D AlN thickness, and the mechanism was studied in detail.