I get them too.
Stretching before bed helps a little. Stretching throughout the day helps a lot more.