Antiretroviral (ARV)-treated patients often maintain low to moderate levels of viremia, despite the emergence of drug-resistant human immunodeficiency virus (HIV). We studied host and viral factors that may contribute to the control of viral replication in a cohort of 189 adults. Among ARV-treated patients with detectable viremia, there was a bell-shaped relationship between Gag-specific CD4+ T cell responses and viremia, with the highest cellular immune responses observed in patients with plasma HIV RNA levels of 1000-10,000 copies/mL. In contrast, there was a negative association between Gag-specific CD4+ T cell responses and viremia among ARV-untreated individuals with wild-type HIV. Strong cellular immune responses among individuals with drug-resistant HIV predicted subsequent lack of virological progression. Finally, there was a positive correlation between replicative capacity and viremia. Collectively, these data suggest that the selection of drug-resistance mutations may reduce the pathogenic potential of HIV, which leads to a balanced state of enhanced cellular immunity and low-level viremia.