Stress and circadian systems are interconnected through the hypothalamic-pituitary-adrenal (HPA) axis to maintain responses to external stimuli. Yet, the mechanisms of how such signals are orchestrated remain unknown. Here, we uncover the gut microbiota as a regulator of HPA-axis rhythmicity. Microbial depletion disturbs the brain transcriptome and metabolome in stress-responding pathways in the hippocampus and amygdala across the day. This is coupled with a dysregulation of the circadian pacemaker in the brain that results in perturbed glucocorticoid rhythmicity. The resulting hyper-activation of the HPA axis at the sleep/wake transition drives time-of-day-specific impairments of the stress response and stress-sensitive behaviors. Finally, microbiota transplantation confirmed that diurnal oscillations of gut microbes underlie altered glucocorticoid secretion and that L. reuteri is a candidate strain for such effects. Our data offer compelling evidence that the microbiota regulates stress responsiveness in a circadian manner and is necessary to respond adaptively to stressors throughout the day.