The nitrate and phosphate removal in sulfur based (Vp) and sulfur-iron based autotrophic denitrification systems (Sp) with sponge iron as the iron source was investigated under different pH (6–9). In this study, Sp (>98 %) and Vp (>97 %) had higher nitrate removal efficiency at pH 7–8 and the highest phosphate removal efficiency (94.9 % ± 3.57 %) at pH 6. The flow cytometry detection revealed that the cell integrity was damaged due to the formation of iron crusts at pH 6, which resulted in irreversible inhibition in Sp. Electron transfer and nitrogen transformation showed that compared with the sustained inhibition of denitrification at pH 6, the inhibition at pH 9 occurred mainly in the initial 0–2 h due to the enhanced flow of electrons toward the formation of biological element sulfur (Sbio0). Coupled sponge iron promoted the adsorption and reduction of NO2−/N2O and reduced N2O emissions. Metatranscriptomics analysis showed that significant upregulation of key gene expression for nitrogen and sulfur metabolism in Sp, with complex regulatory mechanisms enhancing system stability and performance. Acidic conditions reduced the abundance of denitrification and sulfur oxidation functional genes. However, alkaline conditions (pH of 9) mainly caused the decreased abundance of denitrification functional genes, which was favorable for accumulation of Sbio0. This study provides a theoretical basis for the stable operation and regulation of the sulfur-iron based autotrophic denitrification process.