Bacteria and excessive inflammation are two main factors causing non-healing wounds. However, current studies have mainly focused on the inhibition of bacteria survival for wound healing while ignoring the excessive inflammation induced by dead bacteria-released lipopolysaccharide (LPS) or peptidoglycan (PGN). Herein, a boron-trapping strategy has been proposed to prevent both infection and excessive inflammation by synthesizing a class of reactive metal boride nanoparticles (MB NPs). Our results show that the MB NPs are gradually hydrolyzed to generate boron dihydroxy groups and metal cations while generating a local alkaline microenvironment. This microenvironment greatly enhances boron dihydroxy groups to trap LPS or PGN through an esterification reaction, which not only enhances metal cation-induced bacterial death but also inhibits dead bacteria-induced excessive inflammation both in vitro and in vivo, finally accelerating wound healing. Taken together, this boron-trapping strategy provides an approach to the treatment of bacterial infection and the accompanying inflammation.