While it's important to wash your hair frequently when you have dandruff, make sure your strands are at least somewhat dry before you hit the hay. Sleeping on wet hair increases your risk of infections, including fungal infections like Malassezia folliculitis, which causes dandruff.