This study aimed to comprehensively evaluate factors that influence the likelihood of syphilis infection from risk-taking behaviours and medical conditions. A retrospective case-control study was conducted by enrolling 664 syphilis inpatients (excluding 11 congenital syphilis patients) and 800 sex- and age-matched controls. Medical histories, clinical data and patient interview data were collected and subjected to logistic regression analyses. The prevalence of syphilis in the study population was 3·9% (675/17 304). By univariate analysis, syphilis infection was associated with migration between cities, marital status, smoking, reproductive history, hypertension, elevated blood urea nitrogen (BUN) and infection with hepatitis B virus (HBV) (P < 0·05). A high rate of syphilis-HBV co-infection was observed in HIV-negative patients and further research revealed an association between syphilis and specific HBV serological reactivity. Syphilis was also associated with the frequency, duration and status of tobacco use. Multivariate analysis indicated that syphilis infection was independently associated with migration between cities [adjusted odds ratio (aOR) 1·368, 95% confidence interval (CI) 1·048–1·785], current smoking (aOR 1·607, 95% CI 1·177–2·195), elevated BUN (aOR 1·782, 95% CI 1·188–2·673) and some serological patterns of HBV infection. To prevent the spread of infectious diseases, inpatients and blood donors should be tested for HIV, syphilis, HBV and HCV simultaneously.