A growing body of research suggests that our bodies function optimally when we align our eating patterns with our circadian rhythms.

Nutrition scientists have long debated the best diet for optimal health. But now some experts believe that it’s not just what we eat that’s critical for good health, but when we eat it.

A growing body of research suggests that our bodies function optimally when we align our eating patterns with our circadian rhythms, the innate 24-hour cycles that tell our bodies when to wake up, when to eat and when to fall asleep. Studies show that chronically disrupting this rhythm — by eating late meals or nibbling on midnight snacks, for example — could be a recipe for weight gain and metabolic trouble.

That is the premise of a new book, “The Circadian Code,” by Satchin Panda, a professor at the Salk Institute and an expert on circadian rhythms research. Dr. Panda argues that people improve their metabolic health when they eat their meals in a daily 8- to 10-hour window, taking their first bite of food in the morning and their last bite early in the evening.

This approach, known as early time-restricted feeding, stems from the idea that human metabolism follows a daily rhythm, with our hormones, enzymes and digestive systems primed for food intake in the morning and afternoon. Many people, however, snack and graze from roughly the time they wake up until shortly before they go to bed. Dr. Panda has found in his research that the average person eats over a 15-hour or longer period each day, starting with something like milk and coffee shortly after rising and ending with a glass of wine, a late night meal or a handful of chips, nuts or some other snack shortly before bed.

Scientists have long known that the human body has a master clock in the brain, located in the hypothalamus, that governs our sleep-wake cycles in response to bright light exposure. A couple of decades ago, researchers discovered that there is not just one clock in the body but a collection of them. Every organ has an internal clock that governs its daily cycle of activity.

Do you binge eat at night? Your hormones may be to blame.

During the day, the pancreas increases its production of the hormone insulin, which controls blood sugar levels, and then slows it down at night. The gut has a clock that regulates the daily ebb and flow of enzymes, the absorption of nutrients and the removal of waste. The communities of trillions of bacteria that comprise the microbiomes in our guts operate on a daily rhythm as well. These daily rhythms are so ingrained that they are programmed in our DNA: Studies show that in every organ, thousands of genes switch on and switch off at roughly the same time every day.

“We’ve inhabited this planet for thousands of years, and while many things have changed, there has always been one constant: Every single day the sun rises and at night it falls,” Dr. Panda said. “We’re designed to have 24-hour rhythms in our physiology and metabolism. These rhythms exist because, just like our brains need to go to sleep each night to repair, reset and rejuvenate, every organ needs to have downtime to repair and reset as well.”

Most of the evidence in humans suggests that consuming the bulk of your food earlier in the day is better for your health, said Dr. Courtney Peterson, an assistant professor in the department of nutrition sciences at the University of Alabama at Birmingham. Dozens of studies demonstrate that blood sugar control is best in the morning and at its worst in the evening. We burn more calories and digest food more efficiently in the morning as well.

At night, the lack of sunlight prompts the brain to release melatonin, which prepares us for sleep. Eating late in the evening sends a conflicting signal to the clocks in the rest of the body that it’s still daytime, said Dr. Peterson.

“If you’re constantly eating at a time of day when you’re not getting bright light exposure, then the different clock systems become out of sync,” she said. “It’s like one clock is in the time zone of Japan and the other is in the U.S. It gives your metabolism conflicting signals about whether to rev up or rev down.”

Most people know what happens when we disrupt the central clock in our brains by flying across multiple time zones or burning the midnight oil: Fatigue, jet lag and brain fog set in. Eating at the wrong time of day places a similar strain on the organs involved in digestion, forcing them to work when they are programmed to be dormant, which can increase the risk of disease, said Paolo Sassone-Corsi, the director of the Center for Epigenetics and Metabolism at the University of California, Irvine.

“It’s well known that by changing or disrupting our normal daily cycles, you increase your risk of many pathologies,” said Dr. Sassone-Corsi, who recently published a paper on the interplay between nutrition, metabolism and circadian rhythms.

A classic example of this is shift workers, who account for about 20 percent of the country’s workforce. Many frequently work overnight shifts, forcing them to eat and sleep at odd times. Nighttime shift work is linked to obesity, diabetes, some cancers and heart disease. While socioeconomic factors are likely to play a role, studies suggest that circadian disruption can directly lead to poor health.

In one experiment, scientists found that assigning healthy adults to delay their bedtimes and wake up later than normal for 10 days — throwing their circadian rhythms and their eating patterns out of sync — raised their blood pressure and impaired their insulin and blood sugar control. Another study found that forcing people to stay up late just a few nights in a row resulted in quick weight gain and reduced insulin sensitivity, changes linked to diabetes.