The pollution problems of manure and wastewater in large-scale pig farms are becoming more and more serious with the rapid development of the pig industry. Using straw featuring a large specific surface area as filter media for filtering pig farm wastewater can effectively reduce the concentrations of pollutants, such as pig feces, pig urine, and feed residues in the wastewater, alleviating the subsequent treatment burden. However, the remaining straw filter residues with pollutants and high moisture content lack further recycling approaches. Aerobic composting could be favorable for simultaneously processing the straw filter residues and the pig manure. However, nitrogen losses and harmful gas emissions through ammonia (NH3), nitrous oxide (N2O), and methane (CH4) volatilizations remain during aerobic composting due to the high ammonia-nitrogen content of swine manure and the anaerobic reactions occurring under insufficient aeration. The coaerobic composting characteristics of straw filter residues and pig manure were investigated by adding phosphorus and magnesium salts based on the mechanisms of magnesium ammonium phosphate precipitation. Although the additives decreased the temperature and shortened the high-temperature duration to some extent, the NH3, N2O, and CH4 emissions were significantly reduced during aerobic composting, realizing the efficient retention of nitrogen and reducing the emissions of harmful gases. Calcium dihydrogen phosphate [Ca(H2PO4)2] combined with magnesium sulfate (MgSO4) were optimal additives. Under the optimal conditions, the maximal temperature, duration over 50 degrees C, and seed germination index reached 61.24 degrees C, 15 days, and 95.21%. Meanwhile, the total organic carbon and total nitrogen losses and the NH3, N2O, and CH4 emissions were decreased by 1.55%, 21.65%, 69.83%, 33.18%, and 31.34% compared to the blank control without additives. Straw filtration of wastewater and then co-composting of straw filter residues and manure would be a competitive approach for intensive pig farms to dispose of solid-liquid mixed organic pollutants.