Abstract Phosphate pollution, originating from wastewater and runoff, significantly contributes to eutrophication and the degradation of aquatic ecosystems, necessitating efficient removal techniques to safeguard environmental health and water infrastructure. This investigation focuses on optimizing phosphate extraction from aqueous environments using a polarity reversal mode electrocoagulation (PRM-EC) system, integrating iron (Fe) and aluminum (Al) electrodes for synergistic effects. Employing Response Surface Methodology (RSM) and Central Composite Design (CCD), this study systematically explores the interplay between current density, treatment duration, pH levels, and electrode distance on the phosphate removal efficiency. The optimal removal was achieved at a current density of 40 A/m2, duration of 30 minutes, pH of 6.4, and electrode gap of 10.5 mm, resulting in a 93.12% reduction in phosphate with an initial concentration of 100 mg/L. The artificial neural network (ANN) analysis using a three-layered model, indicated current density as the most influencing factor, followed by time, pH, and electrode distance. The mechanism underlying the PRM-EC process encompasses electrode dissolution, floc formation, phosphate adsorption, and precipitation. The findings in the work show that PRM-EC is an environmentally friendly and effective solution for phosphate mitigation.