Your boyfriend's doctor was actually right on target. Hepatitis B vaccination is specifically recommended by the CDC for men who have sex with men (sometimes referred to simply as MSM). This is because MSM are considered to be at higher risk and are affected more than other groups. According to CDC, about 15-20% of new hepatitis B infections each year are among MSM. Yet while infection rates are high among MSM, hepatitis B vaccination rates are low. So healthcare providers are advised to recommend hepatitis B vaccination to MSM (and other groups at high risk too).
Since you mention that your boyfriend tested positive, I wonder if you have been tested? Hepatitis B can be transmitted unprotected vaginal, anal, or oral sex. While using latex condoms correctly and consistently can provide protection (because condoms will reduce contact with infected bodily fluids, like semen) and reduce transmission, they haven't been proven to absolutely prevent infection.
If your test results are negative, you may want to consider vaccination as well. When it comes to prevention, vaccination is your best bet. Hepatitis B vaccination is given in a series of three shots. Talk to your provider for more information on that.
If you want to learn more about hepatitis B infection and vaccination, you might want to check out the ASHA site at: http://www.ashastd.org/learn/learn_hepatitisB.cfm