The perception of visceral pain is a complex process involving the spinal cord and higher order brain structures. Increasing evidence implicates the gut microbiota as a key regulator of brain and behavior, yet it remains to be determined if gut bacteria play a role in visceral sensitivity. We used germ-free mice (GF) to assess visceral sensitivity, spinal cord gene expression and pain-related brain structures. GF mice displayed visceral hypersensitivity accompanied by increases in Toll-like receptor and cytokine gene expression in the spinal cord, which were normalized by postnatal colonization with microbiota from conventionally colonized (CC). In GF mice, the volumes of the anterior cingulate cortex (ACC) and periaqueductal grey, areas involved in pain processing, were decreased and enlarged, respectively, and dendritic changes in the ACC were evident. These findings indicate that the gut microbiota is required for the normal visceral pain sensation.