Harvesting organic matter from wastewater, chemical enhanced primary treatment for instance, is widely applied to maximize energy recovery; however, it limits the applicability of secondary treatment for acceptable effluent discharge into surface water bodies. To turn this bottleneck issue into an opportunity, this study developed oxygen-induced thiosulfatE production duRing sulfATe reduction (ERATO) to provide efficient electron donor for denitrification or partial denitrification anammox in wastewater treatment. Typical pretreated wastewater was synthesized with chemical oxygen demand of 110 mg/L, sulfate of 50 mg S/L, ammonium of 30 mgN/L, and varying dissolved oxygen (DO) and was fed into a moving-bed biofilm reactor (MBBR) with a short hydraulic retention time of 40 min. The ORP maintained at − 311 mV in the bioreactor, indicating that the influent DO was vanished immediately when it enters the bioreactor. In 349 days’ continuous operation, the surface-specific sulfate reduction rate reached 0.42 g S/(m2·d). Notably, the formation rate of thiosulfate reached 0.12–0.18 g S/(m2·d) with a high thiosulfate-Sproduced/sulfide-Sproduced ratio of 38–73% when influent DO was 2.7–3.6 mg/L, much higher than 0–17% obtained in previously reported sulfate-reducing process. Then, batch tests and metabolism analysis were conducted to confirm the oxygen effect on thiosulfate formation, and to explore the mechanism of oxygen-induced thiosulfate formation in ERATO. Results examined that oxygen supply promoted the thiosulfate-Sproduced/sulfide-Sproduced ratio from 4% to 24–26%, demonstrated that S0 and sulfate were critical for thiosulfate production, and indicated that oxygen induces thiosulfate formation mainly through: sulfide first oxidized to S0 which then reacts with sulfite derived from oxygen-regulated biological sulfate reduction (S0 + SO32−→S2O32−). The proposed compact ERATO process with high thiosulfate production, supporting space- and energy-efficient secondary wastewater treatment.