It is commonly accepted that good sleeping habits are helpful for avoiding depression, but many people don’t know that if they are suffering from depression, the symptoms of their depression can cause poor sleeping habits. In fact, your mental health and sleep patterns coincide with each other. Finding the right balance in your sleeping pattern can help in avoiding depression—perhaps more so, in some instances, than medications and other medical remedies prescribed by doctors.

So how is it that a simple thing like sleep can help combat depression? In the late hours of the night when your body is entering into the REM stage sleep cycle, thoughts and feelings that have been repressed or controlled throughout the day gradually begin to unfold in a person’s dreams. This is the reason why many people who suffer from depression report nightmares or bad dreams during REM stage sleep. While regular exercise and mental practices such as yoga and positive thinking techniques can help in avoiding depression, finding the right sleeping environment for your personal needs can also help you to lessen or avoid depression altogether.

Things to keep in mind when considering how to best optimize your sleeping include the firmness or softness of your mattress, how cold or hot your bed gets in the middle of the night, and how suited your mattress is for your body type. Getting a new mattress may not be the magical solution for preventing or avoiding depression, but studies have shown that setting a realistic plan for consistent sleep patterns is directly linked to overall mental health. The best way to make sure you get a good night’s sleep without consistent tossing and turning is to make sure your mattress is the right one for you.