We found a previously unidentified role for HMGB2 in the differentiation and survival of functional memory and exhausted T cells, with vast implications for secondary reinfections and immunotherapies to cancer and chronic viruses. Here, HMGB2 is linked to cancer.