Adoptive cell therapy represents a new paradigm in cancer immunotherapy, but it can be limited by the poor persistence and function of transferred T cells1. Here we use an in vivo pooled CRISPR–Cas9 mutagenesis screening approach to demonstrate that, by targeting REGNASE-1, CD8+ T cells are reprogrammed to long-lived effector cells with extensive accumulation, better persistence and robust effector function in tumours. REGNASE-1-deficient CD8+ T cells show markedly improved therapeutic efficacy against mouse models of melanoma and leukaemia. By using a secondary genome-scale CRISPR–Cas9 screening, we identify BATF as the key target of REGNASE-1 and as a rheostat that shapes antitumour responses. Loss of BATF suppresses the increased accumulation and mitochondrial fitness of REGNASE-1-deficient CD8+ T cells. By contrast, the targeting of additional signalling factors—including PTPN2 and SOCS1—improves the therapeutic efficacy of REGNASE-1-deficient CD8+ T cells. Our findings suggest that T cell persistence and effector function can be coordinated in tumour immunity and point to avenues for improving the efficacy of adoptive cell therapy for cancer.