If it hurts then you're doing it wrong.
Anal sex is very different from vagina sex and must be done with much more preparation. It is suggested you buy anal plugs of increasing sizes, starting with a "beginners" size. Using lube, practice putting them in and wearing them during vaginal or oral sex; or just whenever! This gets your anal muscles used to stretching out, and prevents pain. Just like you have to stretch and practice before you can do the splits in gymnastics, you need to stretch the muscles of your anus.
Once you can fit an anal plug the side of your boyfriend's penis in, then you are ready for sex! This process can take several weeks. Once you're ready, again, use a LOT of lube. Your body should be well practiced in relaxing properly and allow the penis in with no pain
You can also play with anal beads, which are inserted during foreplay and pulled out during orgasm.