To assess the epidemiology of hepatitis B virus (HBV) infection among men who have sex with men (MSM) in Peru, we evaluated the prevalence and associated risk factors for HBV serologic markers among participants of a HIV sentinel surveillance conducted in 2002-2003. The standardized prevalences for total antibodies to hepatitis B core antigen (anti-HBc) and hepatitis B surface antigen (HBsAg) were 20.2% and 2.8%, respectively. Individuals with human immunodeficiency virus (HIV-1) infection had significantly higher anti-HBc (44.3% versus 19.3%) and HBsAg (9.5% versus 2.3%) prevalences than uninfected men. Increasing age (adjusted odds ratio [AOR] = 1.06), versatile sexual role (AOR = 1.59), sex in exchange for money/gifts (AOR = 1.58), syphilis (AOR = 1.74), HIV-1 infection (AOR = 1.64), and herpes simplex virus type 2 (HSV-2, AOR = 2.77) infection were independently associated with anti-HBc positivity, whereas only HIV-1 infection (AOR = 3.51) and generalized lymph node enlargement (AOR = 3.72) were associated with HBsAg positivity. Pre-existing HBV infection is very common among Peruvian MSM and was correlated with sexual risk factors. MSM in Peru constitute a target population for further HBV preventive and treatment interventions.