As far as I know Oda sensei never clarified this topic so we can only speculate until he does. Anyway, I found some related answers in Yahoo! Japan Chiebukuro that discusses it and would like to share.
- Difference between sleeping and being unconscious
If Sugar is the DS console and the people turned into toys are the software, then I think "sleep mode" is sleeping and being "switched off" is being unconscious.
DS above refers to Nintendo DS of course. So basically the answerer is guessing that the effects of Sugar's powers are not cancelled if/when she sleeps as she is only on standby and not entirely "switched off".
- Why was Sugar's power undone when she fainted?
It's not just Sugar whose power became undone after fainting. It was true with Moria and the others too. The bodies that Law switched using Shambles, would probably return to normal too if he fainted. Sleeping and fainting are different. Probably it's that kind of system.
The answerer is guessing that sleeping and fainting are probably treated differently in One Piece.
Personally, I think it's also possible that some characters in One Piece do not need to sleep at all! Anything is possible in that universe. :)