IntroductionKey populations including female sex workers (FSW) and men who have sex with men (MSM) bear a disproportionate burden of HIV. However, the role of focusing prevention efforts on these groups for reducing a country's HIV epidemic is debated. We estimate the extent to which HIV transmission among FSW and MSM contributes to overall HIV transmission in Dakar, Senegal, using a dynamic assessment of the population attributable fraction (PAF).MethodsA dynamic transmission model of HIV among FSW, their clients, MSM and the lower‐risk adult population was parameterized and calibrated within a Bayesian framework using setting‐specific demographic, behavioural, HIV epidemiological and antiretroviral treatment (ART) coverage data for 1985 to 2015. We used the model to estimate the 10‐year PAF of commercial sex between FSW and their clients, and sex between men, to overall HIV transmission (defined as the percentage of new infections prevented when these modes of transmission are removed). In addition, we estimated the prevention benefits associated with historical increases in condom use and ART uptake, and impact of further increases in prevention and treatment.ResultsThe model projections suggest that unprotected sex between men contributed to 42% (2.5 to 97.5th percentile range 24 to 59%) of transmissions between 1995 and 2005, increasing to 64% (37 to 79%) from 2015 to 2025. The 10‐year PAF of commercial sex is smaller, diminishing from 21% (7 to 39%) in 1995 to 14% (5 to 35%) in 2015. Without ART, 49% (32 to 71%) more HIV infections would have occurred since 2000, when ART was initiated, whereas without condom use since 1985, 67% (27 to 179%) more HIV infections would have occurred, and the overall HIV prevalence would have been 60% (29 to 211%) greater than what it is now. Further large decreases in HIV incidence (68%) can be achieved by scaling up ART in MSM to 74% coverage and reducing their susceptibility to HIV by two‐thirds through any prevention modality.ConclusionsUnprotected sex between men may be an important contributor to HIV transmission in Dakar, due to suboptimal coverage of evidence‐informed interventions. Although existing interventions have effectively reduced HIV transmission among adults, it is crucial that further strategies address the unmet need among MSM.