The effect of metallic Mg insertion into the CoFeB/MgO/CoFeB-based magnetic tunnel junction (MTJ) on tunnel magnetoresistance (TMR) properties was investigated using synchrotron x-ray diffraction (XRD) in the out-of-plane geometry. For the MTJ without metallic Mg insertion, both low resistance area product (RA) and TMR ratio tend to decrease as the MgO barrier becomes thinner. When the 0.1-nm-thick metallic Mg is inserted over the MgO barrier, the TMR ratio was found to enhance without increasing the RA value at the MgO thickness range of less than 1.2 nm. Whereas in case the metallic Mg is inserted under the MgO barrier, the TMR ratio tends to deteriorate without changing the RA value. From the XRD spectra, the (200) orientation of MgO with the NaCl structure was confirmed to be improved for the blanket samples with 0.1-nm-thick inserted metallic Mg over the MgO barrier. This can be interpreted as progression of a stoichiometric MgO formation by combining the excess oxygen in MgO with the inserted metallic Mg, which improves the TMR properties. In contrast, when the metallic Mg is inserted under the MgO barrier, the (200) orientation, as well as the TMR ratio, decreases with the increase in the inserted metallic Mg thickness. This can be interpreted that the island growth of inserted Mg on CoFeB and the poor wettability of MgO on the Mg may initiate the interface roughness, which outgrows the MgO/CoFeB interface roughness in the subsequent deposition process.