Greenhouse gases (GHGs) and ammonia (NH3) are the main gas pollutants emitted during composting. This study used boric acid (H3BO3) as an additive to simultaneously mitigate GHG and NH3 emissions during composting and produce boron-rich organic fertilizer. The results showed that high dose of boric acid (1425 mg/kg) simultaneously reduced carbon dioxide (16.4%), methane (97.0%), nitrous oxide (91.7%), and NH3 (27.1%) emissions in the composting process, resulting in the lowest carbon and nitrogen losses and global warming potential. However, low doses of boric acid (75 and 375 mg/kg) promoted nitrous oxide emissions and had limited emission reduction effects on other gases. Pearson correlation analysis showed that Corynebacterium, Planococcus, norank_f_MWH-CFBk5, Ruminofilibacter, norank_o_Actinomarinales and Truepera are key bacterial genera strongly associated with gas emissions. The results of principal co-ordinates analysis, network analysis, and structural equation modeling collectively indicated that the high dose of boric acid mitigates GHG and NH3 emissions by undergoing chemical reactions, altering physicochemical properties, and reshaping bacterial communities. This study provides an innovative approach for synchronously mitigating GHG and NH3 emissions and producing high value-added boron-rich organic fertilizer.