<i>Background:</i> Irritable bowel syndrome (IBS) reflects several pathogenetic entities including a subgroup with low-grade colonic inflammation. We propose that pathogenic bacteria act as triggers and that disturbances of commensal bacteria maintain low-grade inflammation, that in turn leads to dysfunction in the gut or brain. <i>Methods:</i> Studies were performed in mice under specific pathogen-free conditions. Visceral pain was assessed by the visceromotor response and motility was assessed by in vivo fluoroscopy and in vitro by muscle contractility. Brain chemistry was assessed by in situ hybridization and behavior by standard tests. The microbiota was monitored using 16s-based RT-PCR and DGGE. <i>Results:</i> Mice transiently infected with the nematode <i>Trichinella spiralis</i> exhibited changes in motility and in visceral perception that persisted for up to 6 weeks post-infection. This was accompanied by alterations in the microbiota and an upregulation of cyclooxygenase-2 which could be reversed by treatment with anti-inflammatory agents or selected probiotics. To investigate the contribution of the microbiota, we treated mice with oral antibiotics and monitored visceral perception and behavior. Antibiotic therapy produced substantial changes in the microbiota, a small increment in inflammatory activity and an increase in substance P or pain perception. Oral, but not systemic antibiotic treatment, produced changes in brain chemistry and an increase in anxiety-like behavior. <i>Conclusion:</i> These studies provide proof of concept that pathogenic microbes can induce persistent gut dysfunction and that changes in microbial composition of the gut can maintain gut dysfunction as well as induce behavioral changes reminiscent of the psychiatric comorbidity that occurs in up to 60% of irritable bowel syndrome patients.