Antiviral CD8+ T cell responses are characterized by an initial activation/priming of T lymphocytes followed by a massive proliferation, subset differentiation, population contraction and the development of a stable memory pool. The transcription factor BATF3 has been shown to play a central role in the development of conventional dendritic cells, which in turn are critical for optimal priming of CD8+ T cells. Here we show that BATF3 was expressed transiently within the first days after T cell priming and had long-lasting T cell-intrinsic effects. T cells that lacked Batf3 showed normal expansion and differentiation, yet succumbed to an aggravated contraction and had a diminished memory response. Vice versa, BATF3 overexpression in CD8+ T cells promoted their survival and transition to memory. Mechanistically, BATF3 regulated T cell apoptosis and longevity via the proapoptotic factor BIM. By programing CD8+ T cell survival and memory, BATF3 is a promising molecule to optimize adoptive T cell therapy in patients.