I’m playing tennis with Marissa Mayer, and oddly, the Yahoo (yhoo) CEO is wearing a pearlescent purple gown and sipping from a teacup. Her dress is just long enough to obscure her feet, so she appears to be floating across the baseline. As she strikes the ball, she tips her chin skyward and laughs in slow motion.
Meanwhile, I’m perched in the lotus position atop a manta ray that’s hovering above the ground like some kind of Landspeeder. And I’m panicking. How can I keep my balance and still hit the ball—especially with my shirt collar pulling at my neck the way it is? Can’t swing my racket. I jerk my head left. Then right. I claw at my jawline. The ball has cleared the net, and it’s headed my way. If only. I could. Just. Move. My head.
And poof. She’s gone. I open my eyes in a strange room. It’s pitch dark and completely silent, but I manage to find my bearings. Santa Cruz, Calif. Breathing heavily, I carefully disentangle a gaggle of wires twisted around my neck and roll over to glance at the clock. Just after 3 a.m.
This scene, I now know, was merely one of 18 REM-sleep interruptions that I experienced between 11:18 p.m. and 6:16 a.m. during one long February night. What a strange setting for the only dream I’ve ever had about a chief executive: in a laboratory, tethered to a byzantine apparatus designed to monitor my brain activity as well as every breath, eye movement, muscle twitch, and heartbeat.
Let me explain. Like you and probably everyone you know, I’ve always been confounded by my sleep routine. Why do I one morning rise ready to tackle the day and the next seem barely able to lift my head? How much rest can I be getting if I wake up sideways with the covers on the floor and my wife in the guest room? Most important, what can I do better? I don’t want a magic pill. I’ve tried those. I know the rules of thumb: less stress, more exercise, better diet, no afternoon caffeine, put down the damn phone. But I’d kill for a personalized formula.
So I subjected myself to a polysomnography test, or PSG, hoping to unravel some of the mysteries of the night. My procedure was administered in the offices of Fullpower Technologies, one floor down from where I had spent most of the evening talking with the company’s founder and CEO, Philippe Kahn.
A French expatriate who grew up in Paris, Kahn, 63, is a Silicon Valley oracle whose track record predates the web. He founded Borland Software (acquired by Micro Focus) (mcfuf) in the mid-1980s, followed by Starfish software (Motorola) and LightSurf Technologies (VeriSign) (vrsn). In 1997, while anticipating the birth of his daughter, he paired a state-of-the-art Casio (csioy) camera with a Motorola Startac and became, he claims, the first person to transmit a digital photo over cellular airwaves. He’s also been a leader in wearable technologies.
That’s precisely the focus of Fullpower, which licenses its software to other companies. Nearly five dozen framed patents for wearable-related software and devices hang on the wall in the company’s lobby. The oldest dates to 2005, long before tracking steps became such a phenomenon. In the conference room there’s an assembly of chairs and tables around a full-size bed, making obvious Kahn’s latest obsession.
Fullpower built the lab about a decade ago to capture data from sleep patterns. Of course, test subjects don’t typically snooze deeply with wires glued to their skulls, chests, legs, and arms. But almost everyone manages to at least nod off for a while, and the data that subjects generate are valuable and often surprising. “What we found early on is that sometimes you sleep less and feel more refreshed,” Kahn says. “It’s because you woke up in the light part of the sleep cycle.” The insight led him to develop a sleep-cycle alarm that could determine the best time to alert a person within a certain window. “Sometimes it’s better to get up at 10 of seven than at seven,” he says.
Kahn insists that he’s on the cusp of many more such discoveries, and he’s intent on dispelling some of the conventional wisdom that stresses people out. “People say that if you can’t sleep for eight hours without waking up, something’s wrong with you. That’s such a fallacy,” he says. “Before electricity, people used to sleep in two shifts. That’s how I behave. Sleep for four hours, get up and do an hour and a half of work, and then another four.” He’s also skeptical of the notion that a quiet room is the best environment for shut-eye and dismisses the perceived deleterious effects of repeated rousing. “The sign of good sleep hygiene may not be how many times you wake up, but rather how rapidly you fall back to sleep. Sleep should be like hunger. Eat only when you’re hungry and until you’re satisfied.”
Fullpower has oceans of data to back Kahn’s theories. The company provides the sleep-tracking and activity-monitoring software for the Jawbone UP and Nike Fuel (nke) wearable devices as well as a new line of Swiss-made smartwatches and the forthcoming Simmons Sleeptracker Smartbed. The products transmit a mother lode of information (with users’ consent) to Kahn’s team. He thinks that by combining qualitative lab data and quantitative real-world data with machine learning, artificial intelligence, and other analytics technologies, he can unlock the secrets that so many of us walking dead are looking for: a better night’s sleep. “We’re operating a huge sleep experiment, worldwide, unlike anything anyone has ever done,” he says. “We have 250 million nights of sleep in our database, and we’re using all the latest technologies to make sense of it.”
Kahn is not alone. He’s part of a movement of brilliant entrepreneurs, data scientists, engineers, and academics who are looking at demographics, geographies, and lifestyles, and even into our genomes. They’re the beneficiaries of a historic explosion in sleep data, and they’re using many of the same technologies that are busily decoding some of the world’s other great mysteries. Tiny sensors, big data, analytics, and cloud computing can predict machine breakage, pinpoint power outages, and build better supply chains. Why not put them to work to optimize the most valuable complex system of all, the human body?
It’s not an exaggeration to say lack of sleep is killing us. The Centers for Disease Control and Prevention calls it a public health epidemic and estimates that as many as 70 million Americans have a sleep disorder. Sleep deprivation has been linked to clinical depression, obesity, Type 2 diabetes, and cancer. The National Highway Traffic Safety Administration estimates that drowsy driving causes 1,550 deaths and 40,000 injuries annually in the U.S. There are 84 sleep disorders, and some 100 million people—80% of them undiagnosed—suffer from one of them in particular: Obstructive sleep apnea, generally indicated by snoring, costs the U.S. economy as much as $165 billion a year, according to a Harvard Medical School study. That’s more than asthma, heart failure, stroke, hypertension, or drunk driving. And the study doesn’t account for tangential effects, like loss of intimacy and divorce. BCC Research predicts that the global market for sleep-aid products—everything from specialty mattresses and high-tech pillows to drugs and at-home tests—will hit $76.7 billion by 2019.
The financial upside for anyone who can crack the sleep code is obvious. And so the race is on. “I believe that 15 years from now, if we do this right, we can actually tackle epidemics like obesity, diabetes, and high blood pressure, and any number of lifestyle diseases,” says Kahn. “We’re going to help people live longer and better lives.”
In 1934 this magazine ran a sprawling cover story under the simple headline “Sleep.” Published about three decades after the dawn of sleep research, it explored a litany of the day’s devices, concoctions, drugs, and homespun remedies designed, or at least purported, to help insomniacs. The article chronicled the merits of everything from Ovaltine to morphine and Barbital, a synthetic hypnotic that was used as a sleep aid until the mid-1950s despite being habit-forming and occasionally deadly. The story also unpacked the relationship between Zalmon G. Simmons and Harry M. Johnson. Simmons was the president of the eponymous company his father founded, which has by now sold nearly 100 million mattresses, most notably under the Beautyrest brand. Johnson was a psychology professor at Ohio State who was conducting sleep research on the side.
At the time, old Zalmon was looking to solve two problems: He needed to sell more mattresses. And he needed sleep. The head of the iconic mattress maker was an insomniac! So he gave Johnson $25,000 to set up a sleep lab at the university now known as Carnegie Mellon. At the time it was believed that normal sleepers lay motionless throughout the night. Johnson collected 2.5 million data points from 160 subjects and demonstrated the folly of that theory. Normal sleepers, he determined, change positions from 20 to 85 times a night, with 35 being a sort of sweet spot. When we toss and turn more, we wake up groggy; any less, and we’re stiff and sore. (The insight would pay dividends for Simmons, the company. Spurred by the revelation that proper sleep required movement, it became the first to introduce king and queen-size mattresses. Unfortunately, Zalmon didn’t solve his personal problem. His insomnia devolved into depression and, in the words of the article, his “fortune began to wobble. Soon after that, sleep ceased to be a problem. For Zalmon G. Simmons was dead.”)
Those movements are what enable today’s wearable devices to monitor sleep. Gartner Group (it) projects sales of 36 million smart wristbands, a category that includes most Fitbit (fit) devices, Jawbone UP, and Nike Fuel, in 2015 and 2016. Fitbit is definitely king. NPD Group estimates that it has an 85% market share. Fitbit raised $732 million in a highly anticipated IPO stoked by the impressive metrics revealed in its S-1 filing: nearly $132 million in net income on $745 million in revenue last year, with $336 million in revenue in the first quarter of this year. Fitbit has sold more than 21 million devices since 2008 and has 9.5 million active users.
That means Fitbit is gathering far more data in one night than Johnson did in his career. Thanks to its sleep-monitoring technology, the company can distinguish among variations in movements and has determined that the majority of its users actually wake up between three and 17 times a night—9.3 times being average. Most awakenings are short and probably not remembered. Fitbit’s data suggest that the number of awakenings drops with age until about 45, and then remains flat. Men under 50 have, on average, one more awakening per night than women of the same age, but the discrepancy largely disappears after 50.
Fitbit’s research team developed the algorithms to gather and analyze all these data under the guidance of Shelten Yuen. Yuen, 36, who has a Ph.D. in engineering sciences, has worked in missile defense and has done research in surgical robotics. He was approached by Fitbit’s co-founders back in 2010 to write the software underlying the wearable device they were envisioning. “Crazy sensor thing?” Yuen remembers thinking. “That’s my deal.” He signed on as employee No. 4.
The first goal for Fitbit was tracking steps. Yuen figured it would be a snap—until he realized that a regular accelerometer can’t distinguish between a wrist that’s moving with a walking gait and a wrist that’s, say, shoveling food. He delivered what he thought was the perfect device. “They said, ‘Did you try scratching your head? Did you put it in your pocket? How about strapped to a bra?’ Suddenly it became a crazy, phenomenally hard problem,” he remembers.
Steps are easy compared with sleep. For starters, what’s the difference between an absence of movement while trying to sleep and actual sleep? Wearables are beginning to incorporate heart-rate monitoring, which helps correlate sleep stages, but they don’t measure respiration or neural activity like a polysomnograph and so rely more heavily on inference.
Fitbit encounters skepticism from users, including me, about the accuracy of its sleep measurement. Yuen admits he hasn’t achieved perfection, but he largely brushes off the incredulity, saying it stems from the fact that our instincts for how well we’re sleeping don’t typically match reality. For steps, users can monitor their progress, but not so with sleep. (For his part, Kahn insists that he has the formula for maximum accuracy: He says his huge quantity of rock-solid polysomnography data and wristband sleep-tracking information have helped him develop an algorithm that adjusts for the imperfections of wristband data.)
Whatever the accuracy of Fitbit’s data, the company has a ton of it, and is seeing some interesting patterns. Yuen calls one of his data scientists, Jacob Arnold, 31, into the conference room at Fitbit headquarters in San Francisco’s South of Market neighborhood. Arnold also has a Ph.D., his in astronomy and astrophysics. Together they unveil some graphs demonstrating that people around the world get more sleep in winter and less in summer. Daylight clearly has an effect on sleep patterns; temperature might too. We sleep less on the hottest day of the year than on the longest day. The data show that the longest average duration of sleep usually occurs on the weekend following New Year’s Day. Yuen also makes it clear that getting a lot of sleep is not equivalent to having a restful night.
Yuen and Arnold then reveal a graph demonstrating that, statistically speaking, no one gets less sleep than the demographic group to which I belong, forty-something males. I’m not sure how to take the news. Is it a body blow or a hopeful sign of more rest in my future?
Establishing the norm the way these charts do is an important step from a scientific standpoint. But to be indispensable in the marketplace, Fitbit needs to empower users with real guidance. “We need to take the veil off of sleep,” says Yuen. “We need to make this data much more understandable so they don’t feel powerless.”
Fitbit co-founder and CEO James Park echoes the sentiment. Some analysts are predicting that fitness trackers have peaked, especially because of the launch of the Apple Watch (which doesn’t track slumber because it needs to be charged every night). Park knows that if he can help his customers sleep better, Fitbit will become irreplaceable. “A lot of clinical studies show that certain behaviors might affect sleep: light levels, noise levels, caffeine, time of exercise,” says Park. “The next step is to tie prescriptive elements into it. That’s one of the big opportunities for this category. Can companies actually deliver coaching services to help people sleep that consumers actually want to pay for?”
Not long after meeting Steve Kay, dean of the Dornsife school of arts and sciences at the University of Southern California, I notice he’s wearing a Fitbit. Curious about what kind of a sleeper one of the world’s leading experts in circadian rhythm would be, I ask how he’d fared the night before. He looks at the app on his phone. “I went to bed at a quarter past 11 and got up at 20 past four,” he says with a shake of the head. Count Kay among the many of us getting less rest than we need.
I’m in Kay’s conference room with Ross Bersot, a venture partner at Bay City Capital turned entrepreneur. Bersot, 40, and Kay, 53, are a latter-day Zalmon Simmons and Harry Johnson. A few years ago, Kay published research demonstrating that it’s possible to isolate and manipulate the speed of an organism’s circadian rhythm using molecular compounds. Bersot provided funding to Kay’s lab in hopes of potentially starting a company based on more detailed findings. That company, Reset Therapeutics, is now real and based in the Bay Area.
Like Fullpower and Fitbit, Reset is intent on getting to the heart of the nature of sleep. But while others duke it out for wrist real estate, Reset is going deep into our bodies with a different set of tools. It’s pairing Kay’s research with the latest advances in genomics and high-throughput screening, and partnering with personal-genetics startup 23andMe to try to develop a drug that can manipulate our circadian rhythm.
Almost every living thing on earth has an internal clock—or more accurately, a symphony of clocks ticking away at the cellular level—that tells its owner when to rest and when to produce. It’s not just humans. Monsanto recently published a paper demonstrating that it could boost soybean yields 5% by tweaking one of the plant’s clock-associated genes. “We’re trying to help them figure out why,” says Kay, whose lab is working with Monsanto. “And all the major ag and biotech companies are interested. When you’re a plant stuck in the ground, everything is circadian. Biomass, yield, response to extreme temperatures—it’s all clock regulated.”
Human clocks are equally powerful, but we aren’t quite as enslaved by them because we don’t depend on photosynthesis. By some estimates, up to 70% of us live in spite of our internal clocks, or in the scientific jargon, outside our chronotype. Your chronotype predisposes you to being a night owl or a morning person or even being hungry at certain times, and many of us are guilty of ignoring our chronotypes, whether because of our lifestyle or just the call of duty.
When we live largely out of sync with our chronotypes, we experience everything from grogginess and reduced productivity to digestion issues, weight gain, and accelerated aging. We also increase our risk of obesity and Type 2 diabetes. Kay cites studies that link such lifestyles to an increased rate of breast cancer. “We evolved to adapt on this planet that has periods of light and dark. But modern life is really clashing with that,” he says. “The key is being internally synchronized. Your sleep-wake cycles, your food-intake cycles, your metabolic cycles are all working together. When they’re out of sync, that’s when (a) you feel lousy, and (b) you start seeing the disturbance of all kinds of markers. Sleep efficiency collapses. Leptin plummets. Insulin goes up.”
Reset wants to tweak our clocks with a drug. Such a drug would help reset the chronotypes of people who choose or need to live a different lifestyle or whose clocks are impaired. For now the development phase is limited to two so-called orphan diseases, narcolepsy—a neurological disorder that causes significant daytime sleepiness and in some cases cataplectic attacks—and Cushing’s disease, a neuroendocrine disorder characterized by excess blood sugar, obesity, and pituitary tumors.
Working with orphan diseases enables the company to help people sooner and get on the fast track to regulatory approval. “With the Cushing’s program, we’re focused on a protein that makes a clock run at a 24-hour cycle,” says Bersot. And so far, so good: “We’re restoring the rhythms to a 24-hour period, and in our early work with animals, we’ve seen blood glucose and insulin levels return to normal as a result.” Reset plans to take the Cushing’s drug to clinical trials next year and the narcolepsy treatment after that. Bersot hopes that once the drug establishes its ability to reset the body clock for sufferers of those diseases, Reset will develop it more broadly as a sleep aid for shift workers and anyone else whose clock and lifestyle are misaligned.
In the meantime the company is working with 23andMe to explore correlations between chronotypes and various genetic expressions. According to Emily Drabant Conley, 23andMe’s director of business development and a Ph.D. in neuroscience, 80% of 23andMe’s customers allow their genotypes to be used in research. She’s scouring their files in hopes of finding correlations between genotypes and sleep-related survey data. For example, how do people of a given genetic expression most commonly answer these questions: How many hours of sleep do you average? Do you snore? Do you take sleep medication? “Sleep is interesting because it’s not like eye color, where you have only five choices. Having a lot of data that you can mine is important,” she says. “But we’re just at the beginning. We’ve done the first pass at the genetics of being a morning person. We know that genetics plays a role in whether you need six hours or eight hours. The prescriptive aspect will come.”
It’s a common refrain, and despite the way it may sound to someone yearning for rest, it’s hardly a cop-out. In the realm of data science there’s a commonly accepted notion of how progress occurs. First comes descriptive analytics, next predictive analytics, and finally prescriptive analytics. In other words, describe the system, predict outcomes based on those descriptions, and prescribe actions to attain desired outcomes. To the layperson, prescription may sound like the most difficult phase, but in reality the hardest part is often where we are today, measuring and mapping behavior just to get to the point where it’s conceivable to predict behavior and prescribe actions.
Science is clearly advancing in the quest to understand sleep. We’re adding data in quantities that were unimaginable even a decade ago, much less during the time that Fortune first considered the subject. Big Pharma and biotech companies are drilling into our genomes to find links between DNA and nighttime routines; they’re also exploring medications that adjust the circadian rhythm.
Wearable-device companies are casting nets far and wide. Fitbit recently enabled its devices to track sleep automatically, rather than as a user-triggered behavior, and some of its devices now monitor heart rate, which helps Yuen and Arnold make finer distinctions between lack of motion and restful sleep. Full-power just entered a partnership with Simmons to provide sleep-tracking technology for the mattress maker’s new Sleeptracker Smartbed, which will provide noninvasive sleep-monitoring technology and is scheduled to hit the market in 2016.
On top of all this, scientists around the world are using cheap wearables to conduct their own exploratory research. A quick search of Google Scholar shows dozens of wearable-powered experiments and papers detailing the efforts to unravel the mysteries of the night. All of which will—one day soon, let’s hope—translate to a more personalized analysis and formula for how each of us can get a better night’s sleep.
Which brings me back to my night in Fullpower’s sleep lab. A few days after my test I received a PSG report that shines a light on my own personal darkness. The prognosis was mixed. The good news: My sleep-efficiency score was a robust 93.5%—“You should be proud of that,” says Kahn—which means that most of the time I’m in bed, I’m sleeping. And I’m quick. I drifted off in 2.5 minutes, even with all those wires attached. The bad: I snored. In fact, I was diagnosed with “mild to moderate” apnea. That officially makes me part of the $165 billion problem. I was advised to see a doctor.
That’s not the prescription I was looking for. I’m not crazy about doctors, and I’m afraid of being persuaded to buy a machine that I won’t use. So for now, I think I’ll just keep trying to do what I know to be right. Exercise. Keep a consistent routine. Restrict the hours that I eat, try to lay off the junk food and booze, and hope that before long someone will offer me a more personalized regimen.
Until then, I’ll always have the memory of a laughing, volleying Marissa Mayer and the knowledge that together, on one strange night in Santa Cruz, we—and whatever caused my 17 other REM interruptions—slept, or at least tried to, in the name of progress.
Jeffrey O’Brien is a former Fortune senior editor and co-founder of StoryTK, a Bay Area studio that crafts stories for companies.
A version of this article appears in the July 1, 2015 issue of Fortune magazine with the headline “Cracking the Sleep Code.”