Background: The human immunodeficiency virus (HIV) is associated with cognitive impairment, and loneliness is associated with cognitive decline in old age. Older Black adults with HIV may be at particular risk of loneliness due to stigma and lack of social resources. Objective: We tested the hypotheses that (1) older Black adults with HIV would show greater loneliness than older White adults with HIV, and (2) greater loneliness among older Black adults with HIV would be associated with poorer cognitive function. Methods: A total of 370 participants (177 with HIV, 193 without HIV; mean age 58.8 years, standard deviation 6.2 years; mean education 13.4 years, standard deviation 2.9 years; 73.9% male, 68.9% Black) in a community-based cross-sectional study of the Rush Center of Excellence on Disparities in HIV and Aging (CEDHA) completed a 5-item self-report scale used to measure emotional loneliness and a battery of cognitive measures. Results: Contrary to our expectations, older Black adults indicated less overall loneliness than White adults (β = -0.3893, SE = 0.1466, p = 0.0087) in models controlling for the effects of age, education, sex, global cognition, and income. However, in models with cognitive function as the outcome, an interaction between race and loneliness was observed, such that older Black adults who indicated greater loneliness showed poorer cognitive function relative to White adults (β = -0.2736, SE = 0.1138, p = 0.0174). Conclusion: Older Black adults with HIV reported less loneliness than older White adults; however, the inverse association between loneliness and cognitive function was stronger in Black than White older adults. Additional work is needed to elucidate the mechanisms underlying this interaction.