Persons with human immunodeficiency virus (HIV) have a 2.8-fold higher risk than HIV-uninfected persons of nonmelanoma skin cancer (NMSC), defined as basal cell carcinoma (BCC) and squamous cell carcinoma (SCC). Individuals with a prior NMSC history are at increased risk for subsequent NMSC, but the magnitude of risk and its relation to HIV disease-related factors, including CD4 count and viral load (VL), are unknown. To better understand how laboratory markers currently used to evaluate HIV disease progression may be associated with subsequent NMSC risk. This cohort study analyzed 455 HIV-infected and 1945 HIV-uninfected patients, all of them members of the Kaiser Permanente Northern California (KPNC) health care plan, diagnosed with at least 1 NMSC from 1996-2008 to determine risk of subsequent NMSCs in relation to CD4 count and VL. All participants were white, non-Hispanic persons 18 years or older who had had at least 1 NMSC during the 1996-2008 period. Participants entered the cohort at their first NMSC diagnosis and were observed through 2008. Incidence rates were calculated and adjusted hazard ratios were estimated using extended Cox regression models with recent CD4 count and VL analyzed as time-changing covariates. Measured CD4 count, VL, and subsequent NMSC (BCC and SCC). The cohort comprised 455 HIV-infected participants (13 [3%] women) and 1952 HIV-uninfected participants (154 [8%] women). Median duration of observation was 4.6 years, and 16.5% (n = 390) either died (n = 35) or lost KPNC membership status (n = 355) without having a subsequent primary NMSC. Compared with HIV-uninfected persons, HIV-infected individuals were slightly younger (mean age, 52.5 vs 55.5 years), more likely men (97% vs 92%), more likely to have smoked (57% vs 45%), and less likely to be overweight/obese (50% vs 61%). The small observed differences by HIV status in matching characteristics (ie, age and sex) resulted from the restriction of the original cohort to those with at least 1 NMSC. Compared with uninfected individuals, those with HIV infection with a recent biomarker of more severe immune deficiency (CD4 count <200 cells/mL) had a 44% increased risk of subsequent NMSC overall and a 222% increase risk of SCC in particular, suggesting that subsequent SCC risk is associated with immune dysfunction. HIV-infected persons compared with HIV-uninfected persons were are at higher risk for subsequent new SCC but not BCC, with a dose-response relationship between risk and lower CD4 counts and higher VLs. Subsequent new primary SCCs had a strong association with lower CD4 and higher VL among HIV-infected persons, suggesting that immune dysfunction might contribute to increased SCC risk. Clinical implications include targeted monitoring for SCC among HIV-infected individuals, particularly those with low CD4 counts or high VLs.