Background HIV incidence in men who have sex with men (MSM) in the UK has remained unchanged over the past decade despite increases in HIV testing and antiretroviral therapy (ART) coverage. In this study, we examine trends in sexual behaviours and HIV testing in MSM and explore the risk of transmitting and acquiring HIV. Methods In this serial cross-sectional study, we obtained data from ten cross-sectional surveys done between 2000 and 2013, consisting of anonymous self-administered questionnaires and oral HIV antibody testing in MSM recruited in gay social venues in London, UK. Data were collected between October and January for all survey years up to 2008 and between February and August thereafter. All men older than 16 years were eligible to take part and fieldworkers attempted to approach all MSM in each venue and recorded refusal rates. Data were collected on demographic and sexual behavioural characteristics. We analysed trends over time using linear, logistic, and quantile regression. Findings Of 13 861 questionnaires collected between 2000 and 2013, we excluded 1985 (124 had completed the survey previously or were heterosexual reporting no anal intercourse in the past year, and 1861 did not provide samples for antibody testing). Of the 11 876 eligible MSM recruited, 1512 (13%) were HIV positive, with no significant trend in HIV positivity over time. 35% (531 of 1505) of HIV-positive MSM had undiagnosed infection, which decreased non-linearly over time from 34% (45 of 131) to 24% (25 of 106; p=0·01), while recent HIV testing (ie, in the past year) increased from 26% (263 of 997) to 60% (467 of 777; p<0·0001). The increase in recent testing in undiagnosed men (from 29% to 67%, p<0·0001) and HIV-negative men (from 26% to 62%, p<0·0001) suggests that undiagnosed infection might increasingly be recently acquired infection. The proportion of MSM reporting unprotected anal intercourse (UAI) in the past year increased from 43% (513 of 1187) to 53% (394 of 749; p<0·0001) and serosorting (exclusively) increased from 18% (207 of 1132) to 28% (177 of 6369; p<0·0001). 268 (2%) of 11 570 participants had undiagnosed HIV and reported UAI in the past year were at risk of transmitting HIV. Additionally 259 (2%) had diagnosed infection and reported UAI and non-exclusive serosorting in the past year. Although we did not collect data on antiretroviral therapy or viral load, surveillance data suggests that a small proportion of men with diagnosed infection will have detectable viral load and hence might also be at risk of transmitting HIV. 2633 (25%) of 10 364 participants were at high risk of acquiring HIV (defined as HIV-negative MSM either reporting one or more casual UAI partners in the past year or not exclusively serosorting). The proportions of MSM at risk of transmission or acquisition changed little over time (p=0·96 for MSM potentially at risk of transmission and p=0·275 for MSM at high risk of acquiring HIV). Undiagnosed men reporting UAI and diagnosed men not exclusively serosorting had consistently higher partner numbers than did other MSM over the period (median ranged from one to three across surveys in undiagnosed men reporting UAI, two to ten in diagnosed men not exclusively serosorting, and none to two in other men). Interpretation An increasing proportion of undiagnosed HIV infections in MSM in London might have been recently acquired, which is when people are likely to be most infectious. High UAI partner numbers of MSM at risk of transmitting HIV and the absence of a significant decrease in the proportion of men at high risk of acquiring the infection might explain the sustained HIV incidence. Implementation of combination prevention interventions comprising both behavioural and biological interventions to reduce community-wide risk is crucial to move towards eradication of HIV. Funding Public Health England.