Trouble getting turned on

Lately sex has been so painful for me that I'm having trouble getting turned on cause I'm afraid of how much it will hurt. And no I'm not new to it, my boyfriend and I have been having sex regularly for over 3 years and it's only became a problem the last few months. Has anyone else experienced this? If so how do you fix it? 😩