It's amazing how our mind can make us have physical symptoms. You had full testing, right? HIV and STD testing would be the normal thing to do after unprotected sex. You did this and everything is negative. So, that's important to remember. Keep reminding yourself of that. Some people get caught in the trap of testing over and over. But it's not necessary if you got negatives at the appropriate times.
Anxiety can cause stressed, contracted muscles which can lead to headache. And we can be hyper focused on things so that we feel aches/pains. Your doctor is probably telling you it is in your head because he's checked for reasons for it. And has found none.
And mental health can cause physical symptoms. Have you considered treating the mental health issues?