T follicular helper (Tfh) cells promote affinity maturation of B cells in germinal centers (GCs), whereas T follicular regulatory (Tfr) cells limit the GC reaction. Store-operated Ca2+ entry (SOCE) through Ca2+ release-activated Ca2+ (CRAC) channels mediated by STIM and ORAI proteins is a fundamental signaling pathway in T lymphocytes. Conditional deletion of Stim1 and Stim2 genes in T cells abolished SOCE and strongly reduced antibody-mediated immune responses following viral infection caused by impaired differentiation and function of Tfh cells. Conversely, aging Stim1Stim2-deficient mice developed humoral autoimmunity with spontaneous autoantibody production due to abolished Tfr cell differentiation in the presence of residual Tfh cells. Mechanistically, SOCE controlled Tfr and Tfh cell differentiation through NFAT-mediated IRF4, BATF, and Bcl-6 transcription-factor expression. SOCE had a dual role in controlling the GC reaction by regulating both Tfh and Tfr cell differentiation, thus enabling protective B cell responses and preventing humoral autoimmunity.