How to relax during sex???

Me and my boyfriend recently became sexually active. He was the person I lost my virginity too. honestly, my first time didn’t hurt as bad as I thought it would, it was just kind of uncomfortable and the next time after that it didn’t hurt either it was just uncomfortable, but then started to feel good towards the end. we’ve had sex multiple times since then and it really just varies. sometimes he can go in no problem and the sex feels so good and then sometimes it hurts so bad going in and we have to stop and then try over and over again. I don’t understand why this is happening because my first couple of times weren’t like this. the times where it hurts it basically just feels like he’s hitting a wall and I get a sharp pain in my vagina. he says he thinks it’s cause I’m thinking about it to much and not relaxing, but then of course when he tells me to just relax I can’t relax. the other night we had the best sex we ever had. it went in no problem, I was super wet, and we did multiple positions (I did have one wine cooler that night so idk if that helped me relax or what?) then the next night we went to have sex and I was expecting it to be like the other night, but it hurt so bad going in and we had to stop. the thing is I don’t know why this is happening! I’m obviously very attracted to my boyfriend and I’m completely comfortable around him. any tips or advice to make every time like the other night? (also, I am completely wet most of the time and if I’m not we use lube so I don’t think that is the issue.)