Objective To determine the prevalence and distribution of hepatitis B virus (HBV) infection in Mianyang. Methods Data were extracted from the 12th five-year National Science and Technology Major Projects——Integrated Prevention and Control of Major Infectious Diseases in Mianyang. A two-level logistic regression model was established to determine factors associated with HBV infection. Results About 4.91% of people in Mianyang were HBsAg positive, which increased with age. HBV infection showed aggregation at townships. Governmental spending ≥¥1 000 000 on public health was a protective factor in the regression model; whereas, age, male gender, medical workers, absent from HBV vaccination, more than 80 g/d alcohol consumption were risk factors of HBV infection. Conclusion Mianyang had medium level of HBV infections. But high HBV prevalence can be found in some townships. The known behavior risk factors all exist in Mianyang, which can serve as a screening tool for identifying high risk populations.