“It’s important for us as a pharmacy benefit management company, as a big retail pharmacy, to endorse digital therapeutics when they work as good as or better than medications one can take by mouth,” Dr. Brennan said. “We can give the stamp of approval from having looked at the scientific information.”

Volunteers in randomized studies who used Sleepio reported feeling milder insomnia than people who used a placebo treatment app or online sleep education. But the app has not been rigorously studied against sleeping pills or in-person behavioral therapy.

[Get the Bits newsletter for the latest from Silicon Valley and the technology industry.]

CVS Health is offering Sleepio just as health experts have soured on prescription sleeping pills.

In 2018, retail pharmacies in the United States dispensed more than 29 million prescriptions for drugs like Lunesta and Ambien. But the F.D.A. warned Americans in April that taking certain sleeping medications had caused dangerous sleepwalking and “sleep driving,” resulting in serious injuries and even deaths. The American College of Physicians now recommends cognitive behavioral therapy — a proven psychological intervention that can help people change negative thinking patterns — as the initial treatment for adults with chronic insomnia.

Peter Hames, the chief executive of Big Health, said he had hit upon the idea for Sleepio after he developed insomnia. He taught himself to modify his poor sleep habits, he said, by reading self-help books on cognitive behavioral therapy by Colin A. Espie, a sleep medicine professor at Oxford University. He and Professor Espie later founded Big Health to digitize the techniques.

“We are taking evidence-based, nondrug therapies like cognitive behavioral therapy that are traditionally delivered face to face by human therapists and then fully automating them,” Mr. Hames said.