Axons in the mature central nervous system (CNS) fail to regenerate after axotomy, partly due to the inhibitory environment constituted by reactive glial cells producing astrocytic scars, chondroitin sulfate proteoglycans, and myelin debris. We investigated this inhibitory milieu, showing that it is reversible and depends on glial metabolic status. We show that glia can be reprogrammed to promote morphological and functional regeneration after CNS injury in Drosophila via increased glycolysis. This enhancement is mediated by the glia derived metabolites: L-lactate and L-2-hydroxyglutarate (L-2HG). Genetically/pharmacologically increasing or reducing their bioactivity promoted or impeded CNS axon regeneration. L-lactate and L-2HG from glia acted on neuronal metabotropic GABAB receptors to boost cAMP signaling. Local application of L-lactate to injured spinal cord promoted corticospinal tract axon regeneration, leading to behavioral recovery in adult mice. Our findings revealed a metabolic switch to circumvent the inhibition of glia while amplifying their beneficial effects for treating CNS injuries.