Investigation of the thermal stability of Ge2Sb2Te5 (GST) layer in contact with TiN film is very valuable for phase-change memory applications. In this work, the effect of Ti/N atomic ratio in TiN film on thermal stability of GST film has been thoroughly analyzed. After annealing at 410degC for 30 min, the Ti-rich TiN thin film is found to interact with GST material but there does not exist any mixing of Ti, Sb and Te atomic species at the interface between the stoichiometric TiN film and GST, which indicates the stoichiometric TiN film is stable against GST. A Ti-rich TiN film has Ti phase and other TiN compound phases. The presence of the Ti atoms promotes the mutual diffusion and interaction of Ti, Sb and Te under thermal annealing. To ensure the thermal stability of GST in contact with TiN and the performance of device, the Ti/N atomic ratio should be given more attention in the fabrication of PCM devices. Clear boundary and normal operation character are achieved in the T-shaped phase change memory devices with TiN0.6 film.