Layered P2-Na0.67Mn0.67Ni0.33O2 has been considered an attractive cathode material for sodium-ion batteries (SIBs). Nevertheless, it is still burdened with hazardous phase transformation of P2-O2 under high voltage and harmful reactions at the interface of the electrode and electrolyte. These result in unfavorable structural degradation and rapid capacity decay. Herein, a gradient Mg2+ doping approach is proposed to trigger a structural transformation. During the annealing process, the bulk-diffused Mg2+ and surface residual Mg2+ induce the formation of the P2/P3@MgO structure. Consequently, this method combines the merits of the composite phases, bulk doping, and surface modification. In consequence, Na+ diffusion kinetics and electrochemical performances are remarkably enhanced. The cells using P2/P3@MgO show 69.7% capacity retention at 0.2 C within a voltage range of 1.5-4.5 V for 100 cycles, compared with the 42.6% for P2-Na0.67Mn0.67Ni0.33O2. This work offers new insights into further developments of advanced layered oxide cathodes for SIBs.