If you’ve been having trouble falling asleep at night, it might be because you have been staring at your screen instead of counting sheep before bed.

We’ve all been guilty of spending too much time binging on Netflix shows or reading on our laptops, eReaders or smartphones right before bedtime. Instead of relaxing us, all too often we discover that it’s a lot more difficult to fall asleep. That’s because being exposed to a screen light can seriously disrupt natural sleep patterns and can even be more harmful to our health.

According to a study from Boston’s Brigham and Women’s Hospital, published in the Proceedings of the National Academy of Sciences, using an iPad or a similar electronic device directly affects users’ alertness for the next day. The same is true when you use a mobile device late at night.

“Artificial light from electronic devices affects alertness, sleepiness and reduces the level of melatonin,” says Anne-Marie Chang, PhD, an associate neuroscientist at Brigham and Women’s Hospital, who worked on the research. The research compared the sleeping patterns of those who read printed books versus those who read from a device with artificial light.

Participants who read on light-emitting devices took longer to fall asleep, had less REM sleep [dream state] and had higher alertness before bedtime. It was also shown that after an eight-hour sleep period, those who read on the light-emitting device were sleepier and took longer to wake up. The effects in the real world may actually be even greater than what was achieved in the controlled study group.

According to the authors of the study, since more people are choosing electronic devices for reading, communication and entertainment, more long-term health issues may also be lurking. Studies have linked reduced sleep with obesity and diabetes. Scientists have also discovered that interrupted circadian rhythms (physical, mental and behavioral changes that follow a 24-hour cycle, responding to light and darkness) may lead to increased risk of breast cancer and prostate cancer.

Lack of sleep is also associated with a number of other ailments. For example, research indicates that people who get less sleep (six or fewer hours a night) have higher blood levels of inflammatory proteins than those who get more. The C-reactive protein, which is associated with risk of heart attack, was higher in people who got six or fewer hours of sleep a night. Getting a good night’s sleep can also increase creativity, help athletic performance, sharpen attention span, decrease stress levels and fight depression.

“Blue light from screen time suppresses melatonin,” says Raj Dasgupta, MD, assistant professor of clinical medicine at Keck Medicine of USC.

Since the blue light emitted from the screens was the main reason for the negative effects, doctors recommend placing a physical filter for iOS devices or using special Android apps that acts like a filter, such as Twilight or CF.lumen. There is even an app designed for computer screens called F.lux, which changes the color of your computer screen depending on the time of day. Of course, there is the foolproof option of reading books the old-fashioned way on the printed page. Not only will you fall asleep faster, you’ll wake up feeling more refreshed — and perhaps a little wiser — in the morning.

If you are having difficulty sleeping, the USC Sleep Disorders Center of Keck Medicine of USC can help. If you are in the Los Angeles area, be sure to schedule an appointment by calling (800) USC-CARE (800-872-2273) or by visiting http://keckmedicine.org/request-an-appointment/.

By Ramin Zahed