How do you get rid of neck pain from sleeping in the wrong position?

Stretching. Stretching and over-the-counter anti-inflammatory such as Ibuprofen may be helpful.
Move. Get up, move around. Stretch. Get some aerobic exercise. If more bothersome, you could try over the counter medication (but follow instructions on the package, and do not take if you have conditions that make them unsafe for you).