Adventurers typically take turns keeping watch while their companions sleep. If five characters are in your group, each of you can take a turn on watch duty for 1½ hours and sleep for 6 hours, so that you spend a total of 7½ hours resting.
When it’s your turn on watch, you actively look for signs of danger. When you start your shift on watch, make a Perception check. If something occurs during your watch, the DM uses the result of your Perception check to determine whether you notice.
If your entire group sleeps at the same time without setting a watch, the DM uses your individual passive Perception scores, counting the –5 penalty for being asleep, to determine whether you hear approaching danger and wake up.
Published in Player's Handbook, page(s) 263.