Revealing the key factors of controlling the reduction and oxidation half reactions of photocatalysis is necessary in order to obtain the implications for designing and developing efficient photocatalysts. In this work, boron-doped TiO2 microspheres consisting of rutile nanorods with the top reactive {111} facets were synthesized by the acidic hydrolysis of TiB2. The thermal diffusion of boron from the inner to surface part of the microspheres results in switching of the preference from photocatalytic H2 evolution to O2 evolution. This switching is caused by the downward shift of surface band edges with the incorporation of boron in surface.