ABSTRACT: Mastitis is one of three bovine diseases recognized as a cause of substantial economic losses every year throughout the world. Niacin is an important feed additive that is used extensively for dairy cow nutrition. However, the mechanism by which niacin acts on mastitis is not clear. The aim of this study is to investigate the mechanism of niacin in alleviating the inflammatory response of mammary epithelial cells and in anti-mastitis. Mammary glands, milk, and blood samples were collected from mastitis cows not treated with niacin (n = 3) and treated with niacin (30 g/d, n = 3) and healthy cows (n = 3). The expression of GPR109A, IL-6, IL-1?, and TNF-? in the mammary glands of the dairy cows with mastitis was significantly higher than it was in the glands of the healthy dairy cows. We also conducted animal experiments in vivo by feeding rumen-bypassed niacin. Compared with those in the untreated mastitis group, the somatic cell counts (SCCs) and the expression of IL-6, IL-1?, and TNF-? in the blood and milk were lower. In vitro, we isolated the primary bovine mammary epithelial cells (BMECs) from the mammary glands of the healthy cows. The mRNA levels of IL-6, IL-1?, TNF-?, and autophagy-related genes were detected after adding niacin, shRNA, compound C, trans retinoic acid, 3-methyladenine to BMECs. Then GPR109A, AMPK, NRF-2, and autophagy-related proteins were detected by Western blot. We found that niacin can activate GPR109A and phosphorylate AMPK, and promote NRF-2 nuclear import and autophagy to alleviate LPS-induced inflammatory response in BMECs. In summary, we found that niacin can reduce the inflammatory response of BMECs through GPR109A/AMPK/NRF-2/autophagy. We also preliminarily explored the alleviative effect of niacin on mastitis in dairy cows.