Last week during the squats (set of 20) at my 19,20th rep I felt tension in my neck (kind of like muscles over contracted) while pushing hard to get those last two reps. So I did my last reps and stopped and the pain was slowly going away, but i was able to feel the dull feeling for few hours after. Few days later when I was doing the warmup, I was able to get same pain just with the empty bar curls warmup. (around rep6-

It looks like the pain reappears when muscles are contracted few times or when blood flow or tension increases. Same pain shows up during the intercourse. The best description I could find was:
"
To date, the best explanation is that the pain is due to muscle contraction and/or blood vessel dilation in the head and neck during intimacy or other activity
"
I went for the deep tissue massage, but it did not fix the problem.
So i decided to take two weeks off, hoping it will go away.
Today i noticed that even when I use my tongue while trying to get some food out of "the between my teeth" (sorry for stupid example) i can cause that shooting pain, so definitely some muscle contraction in neck is causing it.
Will rest fix it?
Is there anything i can do?
Not sure what to do with it.
I want to go back to gym, but I am afraid.