Being female, low CD4 cell counts, viral load ≥1000 copies/ml, WHO stage II and III, depression, anxiety, sleeping in a communal bedroom, and living alone were predictors of poor sleep quality. Here, CD4 is linked to major depressive disorder.