About 90 percent of the body's serotonin comes from cells lining the gut, and a team at Caltech found that gut bacteria help decide how much of it gets made.
The researchers compared germ-free mice to mice with normal gut bacteria and found that specific spore-forming bacteria raised serotonin output from the intestine's own hormone-making cells. Colonizing germ-free mice with those bacteria, or with a mix of bacteria from healthy human donors, restored serotonin levels that had been about 60 percent lower.
Gut serotonin does not act on mood the way brain serotonin does. It mostly manages movement of the intestine and affects platelets in the blood, and the bacteria appeared to work through small molecules that signal the gut's hormone cells rather than acting on them directly. How far the same mechanism extends in people is still being worked out.

Read the original study
Yano et al., Cell, 2015 · doi.org/10.1016/j.cell.2015.02.047
The mood chemical mostly runs the gut.
Source
- Yano, J. M., Yu, K., Donaldson, G. P., Shastri, G. G., Ann, P., Ma, L., Nagler, C. R., Ismagilov, R. F., Mazmanian, S. K., & Hsiao, E. Y. (2015). Indigenous Bacteria from the Gut Microbiota Regulate Host Serotonin Biosynthesis. Cell, 161(2), 264–276. https://doi.org/10.1016/j.cell.2015.02.047