Toll-like receptor 4 (TLR4) identifies Gram-negative bacteria or their products and plays a crucial role in host defense against invading pathogens. In the intestine, TLR4 recognizes bacterial ligands and interacts with the immune system. Although TLR4 signaling is a vital component of the innate immune system, the influence of TLR4 overexpression on innate immune response and its impact on the composition of the intestinal microbiota is unknown. Here, we obtained macrophages from sheep peripheral blood to examine phagocytosis and clearance of Salmonella Typhimurium (S. Typhimurium) in macrophages. Meanwhile, we characterized the complex microbiota inhabiting the stools of TLR4 transgenic (TG) sheep and wild-type (WT) sheep using 16S ribosomal RNA (rRNA) deep sequencing. The results showed that TLR4 overexpression promoted the secretion of more early cytokines by activating downstream signaling pathways after stimulation by S. Typhimurium. Furthermore, diversity analysis demonstrated TLR4 overexpression increased microbial community diversity and regulated the composition of intestinal microbiota. More importantly, TLR4 overexpression adjusted the gut microbiota composition and maintained intestinal health by reducing the ratio of Firmicutes/Bacteroidetes and inflammation and oxidative stress-producing bacteria (Ruminococcaceae, Christensenellaceae) and upregulating the abundance of Bacteroidetes population and short-chain fatty acid (SCFA)-producing bacteria, including Prevotellaceae. These dominant bacterial genera changed by TLR4 overexpression revealed a close correlation with the metabolic pathways of TG sheep. Taken together, our findings suggested that TLR4 overexpression can counteract S. Typhimurium invasion as well as resist intestinal inflammation in sheep by regulating intestinal microbiota composition and enhancing anti-inflammatory metabolites.