Abstract Background This study aimed to investigate the changes in the clinical indicators and influencing factors of treatment duration among human immunodeficiency virus (HIV) patients in whom antiretroviral therapy (ART) was unsuccessful. Methods In this retrospective study, a total of 9,418 HIV patients who failed in ART during 2004–2016 were included and divided into two treatment groups—Group 1 (treatment time ≤3 years, n1 = 5,218) and Group 2 (treatment time > 3 years, n2 = 4,200). Patient follow-up data, including age, cluster of differentiation 4 (CD4) count, and viral load, glucose, creatinine, and triglyceride levels, were extracted from electronic health record databases. Covariance analysis for repeated measures was used to analyze the biochemical indicators, and multiple logistic regression modeling was used to compare relevant data extracted from the Group 1 and Group 2 HIV patient cohorts with different treatment time. Results The median initial CD4 count was 175.0 cells/μl (interquartile range, 77.0–282.0), while the initial CD4 counts for Group 1 were lower than those for Group 2 (P Conclusion The initial biochemical parameters can affect the survival and treatment time of HIV patients. With a comprehensive understanding of the physiological and biochemical indicators of patients, we can reduce the probability of drug withdrawal and prolong the survival time of HIV patients.