It's not bad to sleep with coconut oil in your hair all night.
In fact sleeping with coconut oil in your hair overnight is the best thing you can do to see maximum results from the use of coconut oil in your hair.
To avoid messing up your pillow though cover your head and hair up with a towel to prevent the coconut oil from getting onto your bed and pillow.