Summarize this article:

If you sleep with unkempt hair, it will only become worse and more entangled in the morning. Simply run a comb or brush through your hair to reduce knots and tangles. If you take nighttime showers, it is a good idea to wait until your hair dries before hitting the pillow. You can either blow dry your hair, or wait for it to air dry. This will prevent you forming a crazy bed head look that is hard to manage the next morning. This will keep your hair from forming any cowlicks and give you nice, even waves for a casually-messy-but-polished look. Be sure to wear your braid and hair tie loose so you don't damage your hair. If you loosely tie your hair in a bun with a soft scrunchy, you can avoid any tangles or hair messes the next morning. As soon as you wake up, release your hair and you will be left with an effortlessly chic look. Using a silk or satin pillowcase reduces some of the friction between your pillow and hair. This can help you prevent bed head and damage to your hair.

Summary:
Brush your hair before you sleep. Dry your hair before sleeping. Sleep in a braid. Try wearing a bun to bed. Sleep on a silk or satin pillowcase.