How do you keep your hair out of your face when you sleep?

I usually apply overnight face masks so I really don't want to get it in my hair but tying it up never seems to stay up