Neuroepithelial crosstalk is critical for gut physiology. However, the mechanisms by which sensory neurons communicate with epithelial cells to mediate gut barrier protection at homeostasis and during inflammation are not well understood. Here, we find that Nav1.8CGRP nociceptor neurons are juxtaposed with and signal to intestinal goblet cells to drive mucus secretion and gut protection. Nociceptor ablation led to decreased mucus thickness and dysbiosis, while chemogenetic nociceptor activation or capsaicin treatment induced mucus growth. Mouse and human goblet cells expressed Ramp1, receptor for the neuropeptide CGRP. Nociceptors signal via the CGRP-Ramp1 pathway to induce rapid goblet cell emptying and mucus secretion. Notably, commensal microbes activated nociceptors to control homeostatic CGRP release. In the absence of nociceptors or epithelial Ramp1, mice showed increased epithelial stress and susceptibility to colitis. Conversely, CGRP administration protected nociceptor-ablated mice against colitis. Our findings demonstrate a neuron-goblet cell axis that orchestrates gut mucosal barrier protection.