Sodium phenylbutyrate (PBA) is a derivative of the short-chain fatty acid butyrate and is approved for treatment of urea cycle disorders and progressive familial intrahepatic cholestasis type 2. Previously known functions include histone deacetylase inhibitor, endoplasmic reticulum stress inhibitor, ammonia sink, and chemical chaperone. Here, we show that PBA has a previously undiscovered protective role in host mucosal defense during infection. Administration of PBA to Taconic mice resulted in the increase of intestinal Lactobacillales and segmented filamentous bacteria (SFB), as well as an increase of interleukin 17 (IL-17) production by intestinal cells. This effect was not observed in Jackson Laboratory mice, which are not colonized with SFB. Because previous studies showed that IL-17 plays a protective role during infection with mucosal pathogens, we hypothesized that Taconic mice treated with PBA would be more resistant to infection with Salmonella enterica serovar Typhimurium (S Typhimurium). By using the streptomycin-treated mouse model, we found that Taconic mice treated with PBA exhibited significantly lower S Typhimurium intestinal colonization and dissemination to the reticuloendothelial system, as well as lower levels of inflammation. The lower levels of S Typhimurium gut colonization and intestinal inflammation were not observed in Jackson Laboratory mice. Although PBA had no direct effect on bacterial replication, its administration reduced S Typhimurium epithelial cell invasion and lowered the induction of the proinflammatory cytokine IL-23 in macrophage-like cells. These effects likely contributed to the better outcome of infection in PBA-treated mice. Overall, our results suggest that PBA induces changes in the microbiota and in the mucosal immune response that can be beneficial to the host during infection with S Typhimurium and possibly other enteric pathogens.