Men who have sex with men (MSM) are a large high-risk population for HIV infection in recent years in China. A cross-sectional survey was conducted in Hangzhou, China, to determine rates of condomless anal intercourse (CAI), recent HIV testing (in the recent year) and associated factors using respondent-driven sampling. Questionnaires using face-to-face interviews were employed to collect data on sexual risk behaviors and HIV testing. Five hundred eleven MSM were recruited, of which 459 (89.8%) had anal intercourse in the past 6 months. Of these 459 participants, 457 (99.6%) answered whether they had taken an HIV test in the recent year, so only their data were analyzed. Weighted data were analyzed using bivariate and multivariate logistic regression analysis. The CAI rate with male partners in the past 6 months was 43.7% (95% confidence interval [CI], 34.0–51.5%), while the rate of condomless vaginal intercourse (CVI) was 21.6% (95% CI, 15.6–32.3%). The prevalence of recent HIV testing was 56.8% (95% CI, 48.7–66.5%), while the prevalence of HIV and syphilis were 8.8% and 6.5%, respectively. Multivariate analysis indicated that CAI was associated with earlier homosexual debut, suicidal inclinations, childhood sexual abuse, HIV testing in the recent year, and lower estimate of HIV prevalence. Recent HIV testing was associated with homosexual debut age, engaging in CAI with male partners in the past 6 months, having oral sex in the past 6 months, self-perceived higher likelihood of HIV infection, knowing about antiretroviral therapy for HIV/AIDS, receiving AIDS/sexually transmitted infection (STI) interventions in the past year, and syphilis infection. Given high prevalence of HIV and syphilis, high levels of CAI and CVI, and low HIV testing rate, the results indicated high risk of HIV infection and transmission among MSM. HIV prevention interventions should target MSM with early homosexual debut and psychosocial health problems, while HIV/AIDS education among MSM should focus on increasing knowledge of HIV risk, estimated HIV prevalence and antiretroviral therapy, and improving risk perception of HIV acquisition.