The best way to prevent this is by giving him a hot water bag to keep his legs warm during night time. You can place it near his hip or on the back. In the morning also, you must first give him a hot water bag again and give a gentle movement to his limbs to loosen the stiff muscles.