a, ELISA quantification of plasma corticosterone in Ctrl and ABX mice. Data are pooled from three independent experiments. Ctrl n=12. ABX n = 11. b, ELISA quantification of plasma corticosterone in Ctrl and GF mice. Data are pooled from three independent experiments. Ctrl n = 12. GF n = 11. Data are mean ± SEM. c, Structures of phenyl sulfate, pyrocatechol sulfate, 3-(3-sulfooxyphenyl)propanoic acid and indoxyl sulfate. d, Relative abundances of phenyl sulfate, pyrocatechol sulfate, 3-(3-sulfooxyphenyl)propanoic acid and indoxyl sulfate in fecal samples from Ctrl_fostered, GF and ex-GF_fostered mice as determined by LC-MS. n = 3/group. e, Relative abundances of phenyl sulfate, pyrocatechol sulfate, 3-(3-sulfooxyphenyl)propanoic acid and indoxyl sulfate in cerebrospinal fluid (CSF) samples from Ctrl and GF mice as determined by LC-MS. Data are representative of two independent experiments n = 8/group. Data are mean ± SEM. Unpaired two-sided t tests were used. P values are indicated on the figure. f, A schematic representation of the microbiota-gut-brain axis in fear extinction learning. Our data inform a model whereby alterations in the microbiota and their metabolites influence neuronal function and learning-related plasticity, which may be due to altered microglia-mediated synaptic pruning, and subsequently regulate fear extinction behavior.