Gaseous emissions (i.e. Greenhouse gases (CH4 and N2O) and NH3) were a serious environmental problem during composting. Magnesium salt could effectively reduce NH3 emission with the principle of struvite crystallization. Biochar, particularly modified biochar, could be served as a new type of adsorbent for gaseous reduction. In this study, Mg-modified biochars were successfully prepared with different magnesium to biochar mass ratios, and then used as additives in pig manure composting. Mg-modified biochars exhibited excellent properties in terms of functional groups, porous structure and composition. Adding Mg-modified biochar improved composting performance, and thus synergistically reduced CH4, N2O and NH3 emissions. Especially, Mg-modified biochar prepared with the magnesium to biochar mass ratio of 0.50 (MBC-0.50) achieved the best reduction effects during pig manure composting. Both additive and composting phases could influence the bacterial composition by regulating temperature, pH, electrical conductivity and moisture content. Besides biochar adsorption, NH3 could be further reduced with the formation of struvite crystallization (MgNH4PO4·6H2O) by adding Mg-modified biochar. Pristine and modified biochars inhibited the proliferation of denitrifying bacteria (e.g. Pseudoxanthomonas and norank-f-Methylococcaceae) and anaerobe methanogenic bacteria (e.g. Jeotgalibaca and Lactobacillus) to further mitigate N2O and CH4 emissions. Results from this study provided unique insights to the development of Mg-modified biochar additive for mitigating CH4, N2O and NH3 emissions during composting.