The pain you have is due to neck muscles spasm. Sorry we are not allowed to prescribe medicines, but I can tell you that its a self limiting condition. Just give it rest, do not attempt neck movements. You need a muscle relaxant
medicine/anti inflammatory medicines for a few days, or try using a local ointment as well. Use a hot water bag over the neck. Stop using a pillow immediately. Visit an orthopaedician if the pain is not subsiding in a day or two.