The gut–brain axis is the bidirectional communication between the gut and the brain, which occurs through multiple pathways that include hormonal, neural and immune mediators. The signals along this axis can originate in the gut, the brain or both, with the objective of maintaining normal gut function and appropriate behaviour. In recent years, the study of gut microbiota has become one of the most important areas in biomedical research. Attention has focused on the role of gut microbiota in determining normal gut physiology and immunity and, more recently, on its role as modulator of host behaviour (‘microbiota–gut–brain axis’). We therefore review the literature on the role of gut microbiota in gut homeostasis and link it with mechanisms that could influence behaviour. We discuss the association of dysbiosis with disease, with particular focus on functional bowel disorders and their relationship to psychological stress. This is of particular interest because exposure to stressors has long been known to increase susceptibility to and severity of gastrointestinal diseases.