Understanding and manipulating the two half-reactions of photoinduced electron reduction and hole oxidation are key to designing and constructing efficient photocatalysts. Here, how the spatial distribution of the heteroatom modulates photocatalytic reduction (hydrogen evolution) and oxidation (oxygen evolution) reaction preferences is investigated by moving boron from the core to the shell of an anatase TiO2 microsphere along  via thermal diffusion control. The preference towards photocatalytic hydrogen and oxygen producing reactions from splitting water can be switched by creating a shell with an interstitial Bσ+ (σ ≤ 3) gradient in the TiO2 microsphere. This switching stems from the downward shift of electronic band edges of the shell by a band bending effect that originates from the extra electrons coming from the interstitial Bσ+. These results create new opportunities for designing and constructing efficient photocatalysts by spatial heteroatom engineering.