In response to climate change and phosphorus (P) resource crisis, this study designed a treatment process that coupled adsorption-struvite precipitation to concurrently facilitate carbon fixation and nutrient recovery. A novel electrolysis-pyrolysis method was proposed to prepare a highly-efficient Mg-modified sludge biochar, designated as SB(@EMg), where sewage sludge was used as the raw material to promote carbon reduction in wastewater industry. SB(@EMg) outperformed those adsorbents prepared by other methods with an equivalent Mg feed. As a result, SB(@EMg) effectively facilitated the sequestration of PO43--P through ligand exchange and co-precipitation, achieving a maximum adsorption capacity of 227.98 mg/g. Application of SB(@EMg) for the treatment of P industrial wastewater could achieve 0.13 mg/L of effluent PO43--P concentration. The P-saturated SB(@EMg) was proved to effectively recover NH4+-N and PO43--P from swine wastewater, which could achieve an efficiency of 79.3 % for NH4+-N and 99.11 % for PO43--P. The final product, enriched with P, N and Mg elements, exhibited the potential to promote corn growth as a fertilizer. This innovative process accomplishes multiple resources recovery and utilization without giving rise to secondary pollution, thereby robustly supporting sustainable development and carbon reduction efforts.