Regulation of the immune system is an important function of the gut microbiota. Increasing evidence suggests that modern living conditions cause the gut microbiota to deviate from the form it took during human evolution. Contributing factors include loss of helminth infections, encountering less microbial biodiversity, and modulation of the microbiota composition by diet and antibiotic use. Thus the gut microbiota is a major mediator of the hygiene hypothesis (or as we prefer, "Old Friends" mechanism), which describes the role of organisms with which we co-evolved, and that needed to be tolerated, as crucial inducers of immunoregulation. At least partly as a consequence of reduced exposure to immunoregulatory Old Friends, many but not all of which resided in the gut, high-income countries are undergoing large increases in a wide range of chronic inflammatory disorders including allergies, autoimmunity and inflammatory bowel diseases. Depression, anxiety and reduced stress resilience are comorbid with these conditions, or can occur in individuals with persistently raised circulating levels of biomarkers of inflammation in the absence of clinically apparent peripheral inflammatory disease. Moreover poorly regulated inflammation during pregnancy might contribute to brain developmental abnormalities that underlie some cases of autism spectrum disorders and schizophrenia. In this chapter we explain how the gut microbiota drives immunoregulation, how faulty immunoregulation and inflammation predispose to psychiatric disease, and how psychological stress drives further inflammation via pathways that involve the gut and microbiota. We also outline how this two-way relationship between the brain and inflammation implicates the microbiota, Old Friends and immunoregulation in the control of stress resilience.