Have you ever had one of those nights where you think, “If I fall asleep in the next 5 minutes, I’ll still get 6 hours of sleep”? Another hour passes and it’s, “OK, I can live on 5 hours.” And so on and so forth until you finally accept the fact that tomorrow is screwed?

You need sleep to function, and deep sleep — aka slow-wave sleep — is a vital part of that. Here’s what happens during deep sleep and why you need to get enough of it.

How much sleep do I need?

Everyone reacts to sleep deprivation differently. Are you the Cryptkeeper incarnate if you get less than 8 hours? Or can you function on fumes?

If you do get 8 hours of sleep each night, you’ll spend a third of your life hanging out with Mr. Sandman. That may sound like a lot, but sleep is a necessity — not a luxury. Your body and mind need it to stay on track.

Doctors recommend 7 to 9 hours of sleep a night. Keep in mind, it’s not just about how many Zzz’s you’re catching, it’s the quality. Much like your college breakfast of Mountain Dew and Pop-Tarts, restless sleep isn’t going to sustain you.

Even if you look like an inanimate object when you’re asleep, a lot is happening when you drift off to dreamland. Every 90 minutes or so, your mind cycles through five stages of sleep.

Non-REM sleep

REM is more than a damn fine dad-rock band. It’s also an integral part of your sleep pattern. It’s called REM (short for “rapid eye movement”) because your eyes move around quickly while staying closed. Sleep stages are either REM or non-REM sleep. Most sleep is non-REM.

Stage 1

This is the transition from being conscious to unconscious. Have you ever had the sudden sensation of falling as you start to doze? This is your body reacting to rest mode. Stage 1 doesn’t last very long — around 5 to 15 minutes.

Stage 2

Around 50 percent of your repeated sleep cycles will be spent in this stage. It’s when you’re in a light to medium sleep.

As your body embraces slumber, your heart rate and breathing slow down, your muscles relax, and your body temperature decreases. Brain waves decrease and display sudden short bursts of activity.

Stages 3 and 4 (deep sleep)

Deep sleep occurs in these stages and becomes shorter with each sleep cycle. It’s hard to wake up, even if outside stimuli are popping off around you.

Your body temperature, brain waves, heart rate, and breathing reach their lowest levels. Your muscles are as relaxed as they can be.

Stage 4 is a healing and restorative stage. Your tissue regrows, and cellular energy is restored. Your body heals from the inside out, starting at a cellular level. Amazing, right?

REM sleep

REM kicks in about 90 minutes into sleep. You’ll have three to five REM cycles per night, depending on how long you’re sleeping.

Stage 5

The REM portion — the final stage of sleep — is when you’re most likely to dream. Your brain waves spike and become active like when you’re awake. Your heart rate also increases to a nearly wakeful state, and your breathing may become irregular and fast.

During deep sleep, your pituitary gland produces hormones that help your body grow. Additionally, your brain catalogs information and turns it into memory, helping you retain what you learned the day before. (That’s why staying up all night to cram for a test is a terrible idea.)

Other benefits:

  • growth and restoration of muscles and bones
  • replenishment of daily energy
  • maintenance of blood supply
  • increase of glucose metabolism in the brain

Deep sleep is linked to some annoying but basically harmless disorders, including:

  • wetting the bed
  • sleep-eating
  • night terrors
  • sleepwalking

None of these compare to the issues caused by prolonged exhaustion. The risks of sleep deprivation extend beyond crankiness or passing out at your morning meeting. The consequences can be extreme.

A 2010 study showed that people who consistently get less than 5 hours of sleep per night face a higher risk of premature death than those who get 7 or more hours.

Other risks may include:

  • heart disease
  • diabetes
  • stroke

So, how much sleep do we all need?

Newborn babies usually sleep 8 to 9 hours during the day and 8 hours at night. So two-thirds of their early life is spent sleeping because their little bodies and minds are growing.

Experts suggest adults get 7 to 9 hours per night. Those age 60 and over may have a lighter sleep schedule than younger folks.

Playing catch-up on sleep on your day off may seem like a good idea, but the absolute best thing you can do is get a good amount of sleep every day.

The health trifecta is sleep, a balanced diet, and exercise. You know the expression “you are what you eat”? Well, you’re also how much you sleep. If you’re not spending enough time in dreamland, your overall health will take a hit.

Some side effects include:

  • moodiness
  • memory issues
  • weakened immune system
  • low sex drive
  • high blood pressure
  • heart disease
  • weight gain

If you’re a disciple of the keto craze, you’re in luck. According to some research, a low carb diet may promote sleep and reduce daytime sleepiness. While more research needs to be done to prove this, it may be worth considering.

Anxiety and depression can also be major factors in restless nights. Talk to a mental health professional about sleep improvement options if this applies to you.

Prolonged exposure to comfortable heat can also help before bedtime. So get your rubber ducky and take a nice hot bath or shower before bed. Feeling bougie? Hit the sauna or steam room.

Some other tips include:

  • Stick to a routine. Going to bed and waking up at the same time each day can promote a regular and healthy sleep pattern.
  • Avoid caffeine and sugar several hours before bedtime.
  • Ditch the cigs and pass on booze. Nicotine and alcohol can make it harder to get a good night’s rest. No, passing out drunk doesn’t count.
  • Work out in the morning. Burning energy in the morning can tucker you out by bedtime.
  • Try a light activity if you aren’t feeling sleepy when you should, like reading a book until you’re drowsy.
  • Avoid electronics. Blue light from screens is stimulating. Plus, 10 minutes can quickly turn into 2 hours when you’re hooked on Candy Crush.
  • Get comfy! If that means getting new pillows or spending a little extra on that lavender aromatherapy spray, do it. You can’t put a price on your health.

Voilà! Enjoy your newfound appreciation of deep sleep and the wonders it can do for you.