Both metabolism reprogramming and DNA damage repair play critical roles in tumorigenesis and chemoresistance. However, the underlying mechanism linking the two pathways remains elusive. Here, we show that loss of lactate dehydrogenase A (LDHA) impairs non-homologous end joining (NHEJ) repair and reduces class switch recombination (CSR) in mice. In addition, we found that lactate, a metabolite of glycolysis, is involved in the regulation of NHEJ repair via XLF lactylation modification. Mechanically, upon DNA damage, GCN5 is phosphorylated by ATM, which promotes the interaction between GCN5 and XLF and stimulates the lactylation modification of XLF K288, which locates within the XLF Ku-binding motif (X-KBM). XLF lactylation enhances its interaction with Ku80, promotes XLF recruitment to DNA damage sites and elevates NHEJ efficiency. We solved the cryo-EM structure of Ku70/80 in complex with lactylated X-KBM (laX-KBM) and identified a new binding mode between Ku70/80 and XLF. laX-KBM interacts with Ku80 in a stretched and extended mode, resulting in conformational changes of the Ku80 vWA domain. Moreover, XLF lactylation deficiency impairs NHEJ and sensitizes cancer cells to chemotherapy. We designed a peptide specifically inhibiting XLF K288 lactylation, and combination of this peptide with 5-fluorouracil (5-FU) kill colorectal cancer cells more efficiently in PDX model with hyperactivation of XLF lactylation. Together, these results suggest that GCN5-XLF lactylation axis plays a key role in NHEJ stimulation and that targeting XLF lactylation might be a promising approach to improve chemotherapy efficiency in cancer.