Gut-innervating nociceptor sensory neurons respond to noxious stimuli by initiating protective responses including pain and inflammation; however, their role in enteric infections is unclear. Here, we find that nociceptor neurons critically mediate host defense against the bacterial pathogen Salmonella enterica serovar Typhimurium (STm). Dorsal root ganglia nociceptors protect against STm colonization, invasion, and dissemination from the gut. Nociceptors regulate the density of microfold (M) cells in ileum Peyer’s patch (PP) follicle-associated epithelia (FAE) to limit entry points for STm invasion. Downstream of M cells, nociceptors maintain levels of segmentous filamentous bacteria (SFB), a gut microbe residing on ileum villi and PP FAE that mediates resistance to STm infection. TRPV1+ nociceptors directly respond to STm by releasing calcitonin gene-related peptide (CGRP), a neuropeptide that modulates M cells and SFB levels to protect against Salmonella infection. These findings reveal a major role for nociceptor neurons in sensing and defending against enteric pathogens. Copyright 2019 Elsevier Inc. All rights reserved.