Read up on sleep cycles and how long your body likes to nap! If you wake up from deep sleep you are groggy for a long time after.
I routinely get hammered till late but as long as I sleep 3, 4.5, 6 hours specifically, I'm fine. Even if I have 4 hours ahead of me, I wake myself up after 3 to snooze and not go into a deep sleep.