The redistribution behavior of Mg in a sequentially regrown GaN epilayer on a p-type doped GaN template was studied. All samples in this study were regrown by metalorganic vapor phase epitaxy on the sapphire substrates. A high density and a slow tail of Mg concentration were observed in a nominally undoped layer due to the surface segregation. We found that the insertion of a low-temperature (LT) AlN interlayer was effective to suppress the Mg redistribution in the GaN regrown layer. Analyzing the temperature dependence of the surface segregation, the activation energy of the Mg segregation was estimated to be 0.63 eV in GaN and 2.47 eV in a LT-AlN layer, respectively.