Indigenous microbiota have several beneficial effects on host physiological functions; however, little is known about whether or not postnatal microbial colonization can affect the development of brain plasticity and a subsequent physiological system response. To test the idea that such microbes may affect the development of neural systems that govern the endocrine response to stress, we investigated hypothalamic–pituitary–adrenal (HPA) reaction to stress by comparing germfree (GF), specific pathogen free (SPF) and gnotobiotic mice. Plasma ACTH and corticosterone elevation in response to restraint stress was substantially higher in GF mice than in SPF mice, but not in response to stimulation with ether. Moreover, GF mice also exhibited reduced brain-derived neurotrophic factor expression levels in the cortex and hippocampus relative to SPF mice. The exaggerated HPA stress response by GF mice was reversed by reconstitution with Bifidobacterium infantis. In contrast, monoassociation with enteropathogenic Escherichia coli, but not with its mutant strain devoid of the translocated intimin receptor gene, enhanced the response to stress. Importantly, the enhanced HPA response of GF mice was partly corrected by reconstitution with SPF faeces at an early stage, but not by any reconstitution exerted at a later stage, which therefore indicates that exposure to microbes at an early developmental stage is required for the HPA system to become fully susceptible to inhibitory neural regulation. These results suggest that commensal microbiota can affect the postnatal development of the HPA stress response in mice.