Biogas upgrading to natural gas quality has been under focus the recent years for increasing the utilization potential of biogas. Conventional methods for CO2 removal are expensive and have environmental challenges, such as increased emissions of methane in the atmosphere with serious greenhouse impact. In this study, an innovative microbial electrochemical separation cell (MESC) was developed to in-situ separate and regenerate CO2 via alkali and acid regeneration. The MESC was tested under different applied voltages, inlet biogas rates and electrolyte concentrations. Pure biomethane was obtained at 1.2 V, inlet biogas rate of 0.088 mL/h/mL reactor and NaCl concentration of 100 mM at a 5-day operation. Meanwhile, the organic matter of the domestic wastewater in the anode was almost completely removed at the end. The study demonstrated a new sustainable way to simultaneously upgrade biogas and treat wastewater which can be used as proof of concept for further investigation.