Bovine mastitis is a threat to the health of the dairy cow. MicroRNAs (miRs) serve an important role in the progression of bovine mastitis, regulating immune and defense responses. The present study aimed to investigate the possible effects and mechanisms of bovine mastitis underlying miR-142-5p and Bcl-2 associated athanogene 5 (BAG5) in in vitro lipopolysaccharide (LPS)-induced models. Reverse transcription-quantitative PCR and western blotting were performed to determine mRNA and protein expression levels, respectively. ELISAs were conducted to assess the levels of cytokines and an immunofluorescence assay was performed to determine the expression of BAG5. Cell Counting Kit-8, clone formation and 5-ethynyl-2'-deoxyuridine assays were conducted to determine cell viability and proliferation of bovine mammary epithelial MAC-T cells, respectively. Flow cytometry was performed to measure MAC-T cell cycle distribution and apoptosis, and a luciferase assay was conducted to verify whether BAG5 was a target of miR-142-5p. The results indicated that miR-142-5p was upregulated in MAC-T cells treated with LPS compared with the control group. miR-142-5p mimics transfection significantly activated the cytokines TNF-α, IL-1β, IL-6 and IL-8, and significantly increased the expression levels of NF-κB signaling pathway-related proteins in LPS-treated cells. The luciferase activity of MAC-T cells treated with miR-142-5p mimics and BAG5 3'untranslated region wild type decreased, compared with mutant type. By contrast, BAG5 overexpression significantly downregulated the levels of cytokines, including TNF-α, IL-1β, IL-6 and IL-8, in LPS-treated cells. BAG5 overexpression significantly promoted cell proliferation and viability, decreased apoptosis, and regulated Caspase-3, Caspase-9, Bcl-2 and Bax expression in LPS-treated MAC-T cells, which was significantly reversed by transfection with miR-142-5p mimics. In conclusion, the results of the present study suggested that miR-142-5p may promote the progression of bovine mastitis via targeting BAG5. Therefore, the present study provided the foundations for future investigations.