It seems that you have muscular spasm of the neck which needs a proper rest and precaution to cure.
1. Avoid pillow while sleeping.
2. Use hard bed to sleep.
3. Apply local anti-inflammatory gels at the site.
4. Take muscle relaxant
drugs to reduce pain and allowing painless movement of the neck.
5. Hot and Ice fermentation can help you.
6. Avoid all jerky movements of the neck.
Take proper medications and precautions and you will be better in couple of days.