Although the importance of human genetic polymorphisms in therapeutic outcomes is well established, the role of our 'second genome' (the microbiome) has been largely overlooked. In this Review, we highlight recent studies that have shed light on the mechanisms that link the human gut microbiome to the efficacy and toxicity of xenobiotics, including drugs, dietary compounds and environmental toxins. Continued progress in this area could enable more precise tools for predicting patient responses and for the development of a new generation of therapeutics based on, or targeted at, the gut microbiome. Indeed, the admirable goal of precision medicine may require us to first understand the microbial pharmacists within.