Mastitis is one of most prevalent production disease in dairy herds worldwide, and is responsible for enormous economic losses. Heme oxygenase-1 (HO-1) is a cytoprotective enzyme, which is involved in the response to oxidative stress and inflammatory response. The purpose of this study was to detect the protective effect of HO-1 on LPS-induced mastitis in mice. BALB/c mice were pretreated with hemin (HO-1 inducer) and zinc protoporphyrin (ZnPP; HO-1 inhibitor) at 2 h before LPS stimulation. The results showed that the mammary gland damage, production of inflammatory cytokines IL-1β, and MPO activity in mammary gland tissues were significantly reduced after pretreated with hemin compared with the group of LPS stimulation only. However, ZnPP reversed the effects of hemin. Furthermore, we found that the levels of ROS and NLRP3 inflammasome were increased after LPS stimulation. The increases were inhibited by hemin and the inhibition of hemin on ROS production and NLRP3 inflammasome activation were blocked by ZnPP. In addition, the results showed that hemin reduced the expression of thioredoxin-interacting protein (TXNIP) induced by LPS, and ZnPP attenuated these changes. In conclusion, the results suggested that overproduction of HO-1 may inhibit the activation of NLRP3 inflammasome and the expression of TXNIP. Induction of HO-1 may be served as a promising method against mastitis induced by LPS.