Head pain when laying down or awkward posture

Hello I get headaches and sharp pain on the left top and side. This happens when i am laying down or moving my head or neck. When I am sitting down and not looking ahead. it feels like a painful spasm. To get rid of it i have to get up and move around. Its making sleeping impossible. Has anyone else experienced this please? Thank you