Metformin, the most prescribed antidiabetic medicine, has shown other benefits such as anti-ageing and anticancer effects1–4. For clinical doses of metformin, AMP-activated protein kinase (AMPK) has a major role in its mechanism of action4,5; however, the direct molecular target of metformin remains unknown. Here we show that clinically relevant concentrations of metformin inhibit the lysosomal proton pump v-ATPase, which is a central node for AMPK activation following glucose starvation6. We synthesize a photoactive metformin probe and identify PEN2, a subunit of γ-secretase7, as a binding partner of metformin with a dissociation constant at micromolar levels. Metformin-bound PEN2 forms a complex with ATP6AP1, a subunit of the v-ATPase8, which leads to the inhibition of v-ATPase and the activation of AMPK without effects on cellular AMP levels. Knockout of PEN2 or re-introduction of a PEN2 mutant that does not bind ATP6AP1 blunts AMPK activation. In vivo, liver-specific knockout of Pen2 abolishes metformin-mediated reduction of hepatic fat content, whereas intestine-specific knockout of Pen2 impairs its glucose-lowering effects. Furthermore, knockdown of pen-2 in Caenorhabditis elegans abrogates metformin- induced extension of lifespan. Together, these findings reveal that metformin binds PEN2 and initiates a signalling route that intersects, through ATP6AP1, the lysosomal glucose-sensing pathway for AMPK activation. This ensures that metformin exerts its therapeutic benefits in patients without substantial adverse effects. - https://doi.org/10.1038/s41586-022-04431-8 - 2022