Piggery wastewater is difficult to be treated due to its high concentrations of suspended solids (SS), organic matter and ammonia nitrogen. An integrated process was proposed to treat the piggery wastewater, which consists of anaerobic baffled reactor (ABR), magnesium-ammonium-phosphate precipitation (MAP) and anoxic/aerobic-membrane bioreactor (A/O MBR). The influences of ABR startup conditions, hydraulic retention time (HRT), water temperature, and dissolved oxygen (DO) on the performance of pollutants removal were investigated. The MAP were used to remove the NH4-N in the wastewater discharged from the ABR. Based on the strategy of stepped-loading, the ABR process startup was finished within 60 days and after that, a 73.5% of COD removal efficiency was achieved at the HRT of 24 h and temperature of 25-35℃. Effluents from the ABR were treated by the MAP using magnesium chloride and trisodium phosphate as precipitant. At the optimum conditions that the molar ratio of reagent dosing Mg2+:NH4+:PO43- was 1.2:1:0.95 at the pH value of 8.5-9.0, the removal efficiency of COD, NH4-N and PO43--P reached 28.2%, 85.4%, and 89.7% respectively. At an optimized HRT (16 h) and DO (≥ 3.0 mg·L-1) in the A/O-MBR, the removal efficiency of COD, SS, NH4-N and TN was 82.0%, 95.2%, 72.4% and 67.7%, respectively. As a result, the final effluent quality, including SS, COD, TN and TP, well met the first class standard of the “Discharge standard of pollutants for livestock and poultry breeding” (GB 18596-2001), demonstrating that the new integrated process proposed in this paper was very promising for the treatment of piggery wastewater.