During the perinatal period, the bovine mammary epithelial cells of dairy cows exhibit vigorous metabolism and produce large amounts of reactive oxygen species (ROS). The resulting redox balance disruption leads to oxidative stress, one of the main causes of mastitis. Puerarin (PUE) is a natural flavonoid in the root of PUE that has attracted extensive attention as a potential antioxidant. This study first investigated whether PUE could reduce oxidative damage and mastitis induced by hydrogen peroxide (H2O2) in bovine mammary epithelial cells in vitro and elucidated the molecular mechanism. In vitro, BMECs (Bovine mammary epithelial cells) were divided into four treatment groups: Control group (no treatment), H2O2 group (H2O2 stimulation), PUE + H2O2 group (H2O2 stimulation before PUE rescue) and PUE group (positive control). The growth of BMECs in each group was observed, and oxidative stress-related indices were detected. Fluorescence quantitative PCR (qRT–PCR) was used to detect the expression of tightly linked genes, antioxidant genes, and inflammatory factors. The expression of p65 protein was detected by Western blot. In vivo, twenty cows with an average age of 5 years having given birth three times were divided into the normal dairy cow group, normal dairy cow group fed PUE, mastitis dairy cow group fed PUE, and mastitis dairy cow group fed PUE (n = 5). The contents of TNF-α, IL-6, and IL-1β in milk and serum were detected. In BMECs, the results showed that the PUE treatment increased the activities of glutathione (GSH), superoxide dismutase (SOD), catalase (CAT), and total antioxidant capacity (T-AOC); ROS and malondialdehyde (MDA) levels were reduced. Thus, PUE alleviated H2O2-induced oxidative stress in vitro. In addition, the PUE treatment eliminated the inhibition of H2O2 on the expression of oxidation genes and tight junction genes, and the enrichment degree of NRF-2, HO-1, xCT, and tight junctions (claudin4, occludin, ZO-1 and symplekin) increased. The PUE treatment also inhibited the expression of NF-κB-associated inflammatory factors (IL-6 and IL-8) and the chemokine CCL5 in H2O2-induced BMECs. In vivo experiments also confirmed that feeding PUE can reduce the expression of inflammatory factors in the milk and serum of lactating dairy cows. In conclusion, PUE can effectively reduce the oxidative stress of bovine mammary epithelial cells, enhance the tight junctions between cells, and play an anti-inflammatory role. This study provides a theoretical basis for PUE prevention and treatment of mastitis and oxidative stress. The use of PUE should be considered as a feed additive in future dairy farming.