Unpredictable chemotherapy side effects are a major barrier to successful treatment. Cell culture and mouse experiments indicate that the gut microbiota is influenced by and influences anti-cancer drugs. However, metagenomic data from patients paired to careful side effect monitoring remains limited. Herein, we focus on the oral fluoropyrimidine capecitabine (CAP). We investigate CAP-microbiome interactions through metagenomic sequencing of longitudinal stool sampling from a cohort of advanced colorectal cancer (CRC) patients. We established a prospective cohort study including 56 patients with advanced CRC treated with CAP monotherapy across 4 centers in the Netherlands. Stool samples and clinical questionnaires were collected at baseline, during cycle 3, and post-treatment. Metagenomic sequencing to assess microbial community structure and gene abundance was paired with transposon mutagenesis, targeted gene deletion, and media supplementation experiments. An independent US cohort was used for model validation. CAP treatment significantly altered gut microbial composition and pathway abundance, enriching for menaquinol (vitamin K2) biosynthesis genes. Transposon library screens, targeted gene deletions, and media supplementation confirmed that menaquinol biosynthesis protects Escherichia coli from drug toxicity. Microbial menaquinol biosynthesis genes were associated with decreased peripheral sensory neuropathy. Machine learning models trained in this cohort predicted hand-foot syndrome and dose reductions in an independent cohort. These results suggest treatment-associated increases in microbial vitamin biosynthesis serve a chemoprotective role for bacterial and host cells, with implications for toxicities outside the gastrointestinal tract. We provide a proof-of-concept for the use of microbiome profiling and machine learning to predict drug toxicities across independent cohorts. These observations provide a foundation for future human intervention studies, more in-depth mechanistic dissection in preclinical models, and extension to other cancer treatments.