Using an alternative bio-product is one of the most promising ways to control bovine mastitis and avoid new intra-mammary infections. The aims of this study were to ascertain the prevalence of biofilm-forming bacteria responsible for causing clinical mastitis in dairy herds and to assess the effectiveness of bacteriocins, produced by Bacillus subtilis, in controlling the growth of these bacteria in the milk of animals. A total of 150 milk samples were collected from cows and buffalos suffering from mastitis and the etiological agents were isolated and identified by the VITEK-2-COMPACT-SYSTEM®. Additionally, the capability of the bacterial isolates to produce biofilms was determined. RT-PCR was used to detect enterotoxin-producing genes (sed and seb), resistance genes (mecA and blaZ), and biofilm-associated genes (icaA and fnbA) in the isolated bacteria. The susceptibility patterns of the bacterial isolates to bacteriocins were assessed using an agar well-diffusion assay. S. aureus was significantly more capable of producing biofilms than coagulase-negative Staphylococcus isolates. S. ubris was the strongest biofilm producer among the Streptococcus species. The sensitivity profiles of the Staphylococcus spp. (S. aureus and coagulase-negative Staphylococcus) and their biofilm producers to bacteriocins were significantly higher (100% and 90%, respectively) at the same concentration. Bacteriocins had a lethal effect on Staphylococci, Streptococci, and biofilm development at a dose of 250 µg/mL. In dairy farms, bacteriocins are a viable alternative treatment for the prevention and control of bovine clinical mastitis.