The biguanide drug metformin is widely prescribed to treat type 2 diabetes and metabolic syndrome, but its mode of action remains uncertain. Metformin also increases lifespan in Caenorhabditis elegans cocultured with Escherichia coli. This bacterium exerts complex nutritional and pathogenic effects on its nematode predator/host that impact health and aging. We report that metformin increases lifespan by altering microbial folate and methionine metabolism. Alterations in metformin-induced longevity by mutation of worm methionine synthase (metr-1) and S-adenosylmethionine synthase (sams-1) imply metformin-induced methionine restriction in the host, consistent with action of this drug as a dietary restriction mimetic. Metformin increases or decreases worm lifespan, depending onE. coli strain metformin sensitivity and glucose concentration. In mammals, the intestinal microbiome influences host metabolism, including development of metabolic disease. Thus, metformin-induced alteration of microbial metabolism could contribute to therapeutic efficacy—and also to its side effects, which include folate deficiency and gastrointestinal upset.