Background Daily and on-demand pre-exposure prophylaxis (PrEP) are effective at preventing HIV acquisition among men who have sex with men (MSM), but only daily PrEP is approved in the US. On-demand PrEP may improve uptake and adherence. We identify sub-groups of MSM who would benefit from on-demand PrEP and determine effectiveness achieved if individuals used their optimal regimens. Methods Using data from the HPTN 067 study (study period 2012–2014), we created an individual-based stochastic model of HIV risk in two synthetic MSM populations with parameters separately estimated using data from Harlem, US, and Bangkok, Thailand. Agents were assigned daily and on-demand PrEP for six months each. Two personalized PrEP assignments: optimal, based on improved predicted effectiveness and reduced pill burden, and adherence-based, using daily PrEP adherence, were simulated for another six months. Findings Simulated on-demand PrEP was optimal for approximately one-third of MSM. It was assigned mainly to those with low daily PrEP adherence (88% (Harlem), 95% (Bangkok) of MSM with daily PrEP adherence <40%). Mean effectiveness was slightly higher in the full synthetic population with optimal PrEP assignment compared to universal daily PrEP. Among MSM for whom on-demand PrEP was optimal, mean effectiveness improved by 18 (Harlem) and 7 percentage points (Bangkok). Comparable predicted effectiveness was achieved if on-demand PrEP was assigned to the population with daily PrEP adherence <50%. There was no advantage in assigning on-demand PrEP by sex act frequency. Interpretation On-demand PrEP could benefit many MSM by increasing effectiveness or decreasing pill burden with similar effectiveness. On-demand PrEP may be an effective alternative to daily PrEP for individuals with difficulty taking daily PrEP consistently. Results were similar for Harlem and Bangkok, indicating that these conclusions were robust in populations with different overall adherence levels and may inform future public-health policies. Funding US NIH grant UM1 AI068617