Sleep isn’t an elective; it’s a requirement for physical and mental well-being. Why then are there so many more sleep-deprived nights these days?

“A lot of it has to do with our electrified society,” says Gray Bullard, MD, a pulmonologist and sleep medicine specialist at Wake Forest Baptist Medical Center, in a release. “We live in an era of electrically powered 24-hour activity and that was not the case in most of human history. Our brains have a circadian light-clock that’s the perfect programming for natural sleep, and we’ve drastically manipulated that.

“Compounding the problem further is the explosion of electronic devices and access to them that’s quick and easy at all times, even when we should be going to sleep.”

But insomnia isn’t just a problem of going to sleep. It also includes the inability to stay asleep, waking up prematurely, and not feeling refreshed upon waking. And insomnia isn’t defined by the number of hours a person sleeps or how long it takes them to fall asleep.

“Insomnia is not what a doctor says is poor sleep but what a person perceives to be poor sleep,” Bullard says. “It’s self-reported problematic sleep.”

The negative effects of that problematic sleep frequently include fatigue; daytime drowsiness; difficulty concentrating, learning and remembering; subpar performance at work or school; moodiness, impulsiveness and irritability; and higher incidence of errors and accidents. Insufficient sleep over the long term can increase the risk of heart disease, diabetes, cognitive impairment, and other conditions.

Insomnia itself is usually a secondary disorder—a symptom or side effect of another problem. (Cases of primary insomnia, those not caused or made worse by other factors, are relatively rare.)

Acute insomnia, which can last from a few nights to a couple of months, is often triggered by stress or anxiety related to work, school, family, finances, or a traumatic event; an injury, short-term illness or surgery; a reaction to medication; a schedule disruption (jet lag or a change in work shifts); or environmental factors (noise, light, temperature extremes).

These circumstances can also contribute to chronic insomnia, which occurs at least 3 times a week for at least 3 months, as can simply worrying about not being able to sleep. But long-term insomnia is most frequently associated with persistent stress, chronic medical conditions, other sleep disorders (such as sleep apnea), medication or substance use or abuse, lifestyle habits, and mental health issues.

There is a particularly strong link between chronic insomnia and depression. “Half the patients with major depression also have chronic insomnia and half the people with chronic insomnia have major depression,” Bullard says.

So what should you do if you can’t get a good night’s rest?

One thing you probably shouldn’t do is dash to the drugstore for an over-the-counter remedy. “OTC products tend to be at best a shot in the dark and at worst a cause of negative side effects, especially in older people,” Bullard says.

If your insomnia is a recent development, try patience. In some instances acute insomnia can just go away, especially if the underlying cause is a temporary one that passes or is resolved.

If that’s not the case, evaluate your habits and try to make them conducive to sleeping. Proper sleep hygiene—which includes such measures as establishing a regular sleep schedule, creating a comfortable sleeping environment, and avoiding stimulants close to bedtime—can be very effective in eliminating or reducing sleeping problems.

Still not sleeping well? Go see your family doctor.

“In most instances a family physician can assess the problem, identify underlying causes, recommend remedies, and determine whether further intervention is necessary,” Bullard says.

Further intervention might include referral to a sleep medicine specialist, a physician with a background in pulmonology, neurology, psychiatry, or another discipline who has completed advanced training in sleep disorders and has greater familiarity with their causes and effects than most primary-care practitioners.

“One great thing about sleep medicine is that the physicians who practice it come from several specialties, so it’s truly an interdisciplinary field,” Bullard says. “We all benefit, the patients primarily but also the doctors, from having a mix of specialty input.”

In terms of treatment, cognitive behavior therapy—counseling that focuses on thoughts and behaviors that keep people from sleeping well and introduces techniques and strategies that promote healthy sleep—is widely regarded as the most effective way to combat insomnia. CBT-I, as it’s known, can be done in conjunction with or independent of prescription medications.

“Cognitive behavior therapy is the only well-studied treatment for insomnia that has shown to be reliable and effective,” Bullard says. “We don’t have the same level of positive evidence for any of the drugs that are commonly used. In terms of long-term efficacy, we know enough about the drugs to know that they’re not the first thing we should to turn to.”