Sludge transporting pipes in wastewater treatment plant are easy to be clogged with struvite when the digested sludge and dehydrated filtrate are transported through the pipes, which lowers the efficiency of sludge treatment system in a WWTP. pH is one of the most important factors in struvite formation, and carbon dioxide separated from biogas can be used to control pH and struvite formation. By controlling pH, the amount of dehydrating agent can be reduced by about 10%, which saves the budget for facility maintenance. As CO2 is reused and dehydrating chemicals are saved, the approach can contribute to global warming gas reduction.