Buffalo milk production has become of significant importance on the world scale, however, there are few studies involving biotechnological tools specifically for buffalo. To verify the effects caused by subclinical mastitis on the components of milk and to study the innate immune system in the udder of dairy buffaloes with subclinical mastitis, we evaluated the levels of expression of the lactoferrin (LTF), tumor necrosis factor alpha (TNF-α), interleukin-1 beta (IL-1β), interleukin-8 (IL-8), and toll-like receptors 2 (TLR-2) and 4 (TLR-4) genes in buffaloes with and without subclinical mastitis. Milk samples were collected for the determination of milk components: somatic cell score (SCS), fat, protein, lactose, total solids and solids-not-fat (SNF), as well as for RNA extraction of milk cells, complementary DNA synthesis, and expression profile quantification by quantitative real-time PCR. For gene expression, the ΔΔCt was estimated using contrasts of the target genes expression adjusted for the expression of the housekeeping genes between both groups. Linear regression analysis was performed to determine the relationship between the genes studied and the milk components. Subclinical mastitis induced changes in the fat, lactose and SNF in milk of buffaloes, and the messenger RNA abundance was upregulated for TLR-2, TLR-4, TNF-α, IL-1β and IL-8 genes in milk cells of buffaloes with subclinical mastitis, whereas the LTF gene was not differentially expressed. Results of linear regression analysis showed that TLR-2 gene expression most explains the variation in SCS, and the change in a unit of ΔCt of the TNF-α gene would result in a higher increase in SCS. The study of these immune function genes that are active in the mammary gland is important to characterize the action mechanism of the innate immunity that occurs in subclinical mastitis in dairy buffaloes and may aid the development of strategies to preserve the health of the udder.