Some nanocrystalline TiO 2 materials are notorious for their photoluminescence (PL), which exhibits a pronounced sensitivity to ambient oxygen and has a potential for optical gas sensing. Here, we utilized pulsed laser deposition to obtain thin (70 nm) anatase TiO 2 films containing 1−2 atom % of either samarium (Sm) or neodymium (Nd) impurity ions. The highly porous nanostructure consisted of quite regular, interconnected nanopillars with a wall thickness of 15−20 nm, fully exposing the material to ambient environment. The PL intensity of both ions (induced by 355 nm pulsed laser) responded in a reversible manner to changes of oxygen volume fraction in dry O 2 /N 2 flow. Sm 3+ :TiO 2 worked effectively at room temperature, whereas Nd 3+ :TiO 2 showed an improved relative response at 100−150 °C. Switching between pure nitrogen and oxygen atmospheres affected the PL intensities up to 6 times, with response time of 1 min to O 2 and recovery time of 10 min in N 2 . The PL decay kinetics of Sm 3+ :TiO 2 showed unambiguously that both decreasing O 2 concentration and increasing temperature reduced the fluorescence quantum yield of excited Sm 3+ ions. Such behavior is compatible with the proposed model of energy acceptors created by (reversible) electron transfer from desorbed charged O 2 species to certain lattice defects. In contrast, decreasing O 2 concentration increased the PL intensity of Nd 3+ :TiO 2 . In this case, PL decay kinetics showed an increased excitation efficiency of Nd 3+ ions, suggesting that O 2 adsorption favors a concurrent relaxation path for the photoexcited charge carriers.