First time anal

My boyfriend and I have been talking about trying anal for awhile and the other day we decided to give it our first try. We ended up being unsuccessful. We tried again a couple days later and he was able to get it in a little bit but I made him stop because although it felt good at first, it suddenly got extremely painful a second later to the point that I involuntary had tears running down my face. I felt so bad to have started crying! Any advice on how to make it less painful if we try again? Maybe a different position? We were going doggy style and had used a lot of lube along with a bit of foreplay beforehand to get ready.