If you're trying to lose fat, high quality sleep is essential. Regular sleep loss depresses the immune system. Even as little as one week of inadequate sleep disrupts blood sugar to the level of a prediabetic.
The effects of stress and cortisol disruption often manifest as difficulty in falling asleep or problems staying asleep. Sometimes this is accompanied with a desire to eat before bed or food cravings during the night. Restoring sleep naturally, without the use of pharmaceuticals, is preferable since these act as sedatives, reducing all the benefits of proper sleep.
The underlying cause of sleep problems is stress of some sort. This may include psychological or physical stressors such as insufficient or excessive exercise. Other physical triggers include insufficient sunlight, overexposure to artificial light (like from a cell phone or computer screen), nutrient deficiencies, and excess caffeine or alcohol. These stressors alter the circadian rhythm, affecting cortisol and melatonin release.
But remember, if you've dieted yourself into a state of chronic stress, then raising calories may be an important first step here. For some people, women in particular, raising carbs in the evening can help with sleep and energy production in general by also improving thyroid function (in terms of the conversion of free T4 to free T3).
Free T3 is the metabolically active thyroid hormone. People often have normal thyroid function, but this conversion is subject to change, and can do so almost on an hourly basis. Thyroid function along with the interaction of all the other hormones, enzymes, cofactors, etc. helps provide the energy we need. It basically regulates the sense of fatigue we experience.
Women appear to be more susceptible to low free T3, particularly when they're eating fewer calories and insufficient carbs. Everyone is different and these things change over time – so carb tolerance fluctuates between people and within the same person over a period of time.