Calcium signaling is critical for lymphocyte function, and intracellular Ca2+ concentrations are regulated by store-operated Ca2+ entry (SOCE) through Ca2+ release-activated Ca2+ (CRAC) channels. In patients, loss-of-function mutations in CRAC channel components ORAI1 and STIM1 abolish SOCE and are associated with recurrent and chronic viral infections. Here, using mice with conditional deletion of Stim1 and its homolog Stim2 in T cells, we determined that both components are required for the maintenance of virus-specific memory CD8+ T cells and recall responses following secondary infection. In the absence of STIM1 and STIM2, acute viral infections became chronic. Early during infection, STIM1 and STIM2 were required for the differentiation of naive CD8+ T cells into fully functional cytolytic effector cells and mediated the production of cytokines and prevented cellular exhaustion in viral-specific CD8+ effector T cells. Importantly, memory and recall responses by CD8+ T cells required expression of STIM1 and STIM2 in CD4+ T cells. CD4+ T cells lacking STIM1 and STIM2 were unable to provide "help" to CD8+ T cells due to aberrant regulation of CD40L expression. Together, our data indicate that STIM1, STIM2, and CRAC channel function play distinct but synergistic roles in CD4+ and CD8+ T cells during antiviral immunity.