Primary immunodeficiencies (PIDs) provide researchers with unique models to understand in vivo immune responses in general and immunity to infections in particular. In humans, impaired immune control of Epstein-Barr virus (EBV) infection is associated with the occurrence of several different immunopathologic conditions; these include non-malignant and malignant B-cell lymphoproliferative disorders, hemophagocytic lymphohistiocytosis (HLH), a severe inflammatory condition, and a chronic acute EBV infection of T cells. Studies of PIDs associated with a predisposition to develop severe, chronic EBV infections have led to the identification of key components of immunity to EBV - notably the central role of T-cell expansion and its regulation in the pathophysiology of EBV-associated diseases. On one hand, the defective expansion of EBV-specific CD8 T cells results from mutations in genes involved in T-cell activation (such as RASGRP1, MAGT1, and ITK), DNA metabolism (CTPS1) or co-stimulatory pathways (CD70, CD27, and TNFSFR9 (also known as CD137/4-1BB)) leads to impaired elimination of proliferating EBV-infected B cells and the occurrence of lymphoma. On the other hand, protracted T-cell expansion and activation after the defective killing of EBV-infected B cells is caused by genetic defects in the components of the lytic granule exocytosis pathway or in the small adapter protein SH2D1A (also known as SAP), a key activator of T- and NK cell-cytotoxicity. In this setting, the persistence of EBV-infected cells results in HLH, a condition characterized by unleashed T-cell and macrophage activation. Moreover, genetic defects causing selective vulnerability to EBV infection have highlighted the role of co-receptor molecules (CD27, CD137, and SLAM-R) selectively involved in immune responses against infected B cells via specific T-B cell interactions.