Flocculation can remove large amounts of nitrogen and phosphorus from wastewater, and the resulting nitrogen- and phosphorus-rich floc can be used to produce organic fertilizer. For biogas slurries containing high levels of nitrogen and phosphorus, ordinary flocculants can no longer meet the flocculation requirements. In this study, to fully utilize the advantages of the two flocculants and achieve efficient removal rates of nitrogen and phosphorus from a biogas slurry, chitosan (CTS) and polyaluminum chloride (PAC) were used as a composite flocculation agent to flocculate pig biogas slurries. The response surface method was used to study the effect of PAC added (PACadded) to the composite flocculant (CF), composite flocculant added (CFadded) to the biogas slurry and the pH on flocculation performance, and optimize these three parameters. In the tests, when the PACadded was 6.79 g·100 mL−1CF, the CFadded was 20.05 mL·L−1 biogas slurry and the pH was 7.50, the flocculation performance was the best, with an absorbance of 0.132 at a wavelength of 420 nm. The total phosphorus (TP) concentration was reduced from 214.10 mg·L−1 to 1.38 mg·L−1 for a removal rate of 99.4%. The total ammonia nitrogen (TAN) concentration was reduced from 1568.25 mg·L−1 to 150.27 mg·L−1 for a removal rate of 90.4%. The results showed that the CF could form larger flocs, and had greater adsorption capacity and more stable flocculation performance than ordinary flocculants. Furthermore, the CF could exhibit better chelation, electrical neutralization and bridge adsorption.