The primary function of CTLA-4 is to maintain immune homeostasis by delivering inhibitory signals to T cells. This prevents overactivation of the immune system, which could lead to autoimmune diseases. CTLA-4 competes with the costimulatory molecule CD28 for binding to B7-1 (CD80) and B7-2 (CD86) on antigen-presenting cells (APCs), thereby inhibiting T cell activation and proliferation.