Any sleep doctor will tell you that it’s a bad idea to take your cell phone to bed. But that advice may not be true for all insomniacs. 

An increasing number of people are bringing their cell phones to bed (or at least stashing them on a bedside table) to use an app designed to help promote a good night’s slumber.

What Sleep Apps Do

Sleep apps track your sleep cycles by measuring how much you move during your shut-eye. (The phone is placed face down near you in bed but not under your pillow.) Note: To curb your exposure to cell-phone radiation, activate the “airplane mode,” which disables the cellular connection but doesn’t affect the use of an app.

Nighttime movements can be ­detected because the latest smartphones have built-in accelerometers, electromechanical devices that have traditionally measured movement of an automobile, ship or aircraft. Most sleep apps also use the smartphone’s microphone to detect changes in breathing that can signal movement and record snoring and even sleep talking. 

Three Top Sleep Apps

There are hundreds of sleep apps that can be used on Apple devices (these apps are available at Apple’s App Store) and Android devices (available at ­Google Play). Good choices…

Sleep Cycle functions as a “smart alarm” that helps you wake up at the optimal time for your sleep cycle. It does this by using the phone’s accelerometer or microphone and times the alarm (based on a 30-minute window you set) to gently wake you in the lightest possible sleep stage so you don’t feel groggy. Sleep Cycle also provides graphs showing your nightly sleep cycles. Cost: Free for the basic app…or $29.99 a year for a premium version with such features as an option to choose alarm sounds from your music library.

CBT-I Coach. Cognitive behavioral therapy for insomnia (CBT-I) is an evidence-based form of psychotherapy for treating insomnia. This app is designed for people who are ­undergoing CBT-I with a health-care provider but also can be used by those who want to improve their sleep habits. The app includes advice on developing helpful sleep routines and a sleep diary. Cost: Free.

SleepScore provides several features, including an overall numerical sleep score and a breakdown that allows you to compare your nightly sleep to an ideal night for people of your age and gender. Cost: Free…or $5.99 monthly for premium features, including personalized sleep recommendations.

For Best Results

Avoid excessive self-monitoring. Sleep apps generate so much data that users can become overly focused on each night’s sleep results. Don’t put excessive pressure on yourself to get the “perfect night’s sleep,” which realistically doesn’t exist.

Don’t expect a diagnosis. A sleep app can’t diagnose a sleep disorder, such as sleep apnea. This requires a sleep study that measures your brain activity while you sleep. However, most sleep apps allow you to identify trends in your sleep, which can—and should—be shared with your doctor if you have concerns. Other conditions, such as depression, chronic pain and allergies, also can affect sleep, but sleep apps don’t collect any data specific to those types of conditions.

Use a sleep app as just one tool. Good sleep hygiene relies on many factors, such as keeping a consistent bedtime, avoiding caffeine and alcohol within six hours of bedtime and creating nighttime rituals, such as taking a warm bath or reading, to prepare your body for sleep. If you use a sleep app, think of it as part of a larger toolkit that includes many good sleep habits. 

If your sleep is still poor after using an app for three months, see your doctor for advice and possible treatment. Ongoing sleep deprivation is associated with many health risks, such as diabetes and high blood pressure.