Studies of United States sewage in the late 1960s estimated mean per capita contributions of  in urine and feces,  in synthetic detergents, and lesser variable amounts used as corrosion and scale control chemicals in water supplies. Source control via alternative detergent formulations has subsequently reduced the largest contribution, but naturally the phosphorus content of urine and feces remained unchanged. 
Phosphorus can be removed biologically in a process called enhanced biological phosphorus removal. In this process, specific bacteria, called polyphosphate-accumulating organisms (PAOs), are selectively enriched and accumulate large quantities of phosphorus within their cells (up to 20 percent of their mass). 
Phosphorus removal can also be achieved by chemical precipitation, usually with salts of iron (e.g. ferric chloride) or aluminum (e.g. alum), or lime. This may lead to a higher sludge production as hydroxides precipitate and the added chemicals can be expensive. Chemical phosphorus removal requires significantly smaller equipment footprint than biological removal, is easier to operate and is often more reliable than biological phosphorus removal. Another method for phosphorus removal is to use granular laterite or zeolite.
Some systems use both biological phosphorus removal and chemical phosphorus removal.  The chemical phosphorus removal in those systems may be used as a backup system, for use when the biological phosphorus removal is not removing enough phosphorus, or may be used continuously.  In either case, using both biological and chemical phosphorus removal has the advantage of not increasing sludge production as much as chemical phosphorus removal on its own, with the disadvantage of the increased initial cost associated with installing two different systems.
Once removed, phosphorus, in the form of a phosphate-rich sewage sludge, may be sent to landfill or used as fertilizer in admixture with other digested sewage sludges. In the latter case, the treated sewage sludge is also sometimes referred to as biosolids. 22% of the world's phosphorus needs could be satisfied by recycling residential wastewater.