For good quality sleep, you need to make enough melatonin, also known as the sleep hormone. This is dependent on multiple factors, such as sufficient nutrient intake, good digestion and absorption, sufficient sunlight exposure during the day, and other factors.
Melatonin is also an anti-inflammatory and antioxidant hormone, and can reduce blood pressure, reduce cholesterol, reduce anxiety, reduce pain, and interestingly, reduce blood sugar levels! Many studies show there's a link between poor melatonin levels and poor sleep quality and altered insulin secretion and diabetes! This is likely the result of melatonin receptors on the surface of the insulin-producing cells in the pancreas, meaning that the cells which produce insulin actually respond to melatonin!
Melatonin actually reduces the secretion of insulin! Melatonin is only secreted at night when your eyes sense the levels of sunlight diminishing, and this causes you to secrete less insulin which would otherwise reduce your blood sugar levels. Insulin is a "fat storage" hormone, as it tells the cells in the body to take up the glucose in the blood and use it for energy, but it also tells the liver to convert the excess blood glucose into fat so it can be stored. Hence why high carbohydrate diets lead to increased fat storage and increased weight.
The other part of this picture is that high production and levels of insulin are found during the day, when melatonin isn't secreted (due to bright sun exposure). High levels of blood sugars are very damaging to the body, which over time leads to inflammation and diabetes, and all their complications of hormone imbalance, loss of feeling in extremities from nerve damage (peripheral neuropathy), and kidney and eye damage, and heart disease. If you have diabetes, melatonin secretion in the evening will reduce insulin production, so your blood sugars will remain high all night to cause inflammation and damage. You don't want this!
Melatonin doesn't just help you sleep, but it balances your blood sugars and can help to prevent and reverse diabetes! Insulin production also appears to have more of a priority over melatonin production, so a high carbohydrate diet causes more insulin production and less melatonin, causing sleep disturbances!
I have noticed this with my clients, and I have had great success in reducing diabetes symptoms of high blood sugars and insulin levels mainly by improving their diet at dinner time! Reducing carbohydrates in the evening meal reduces blood sugar levels, which in turn reduces the need to produce more insulin, which results in more melatonin being secreted to improve sleep! In addition, the decreased need for insulin reduces the strain on the cells of the pancreas to make insulin, reduces insulin resistance, and lessens the risk of non-insulin dependent type 2 diabetes turning into insulin-dependent diabetes (ie needing insulin injections).
If you want to prevent diabetes or to reduce diabetes, you must reduce your refined and processed carbohydrate intake at dinner! Remember the "no white (foods) at night" rule! That's no wheat (ie bread, pizza etc), pasta, potato, rice, sugar (ie desserts, ice cream), or alcohol! Harsh I know... but you'll feel better for it and you will sleep better too!