The strain evolution of the GaN layer grown on a high-temperature AlN interlayer with GaN template by metal organic chemical vapor deposition is investigated. It is found that the layer is initially under compressive strain and then gradually relaxes and transforms to under tensile strain with increasing film thickness. The result of the in situ stress analysis is confirmed by x-ray diffraction measurements. Transmission electron microscopy analysis shows that the inclination of edge and mixed threading dislocations rather than the reduction of dislocation density mainly accounts for such a strain evolution. (c) 2006 American Institute of Physics.