Some people struggle greatly with sleeplessness, whereas others appear to be able to nod off effortlessly, regardless of the circumstances. Perhaps the most obvious explanation for differences between us in terms of our sleep is the environmental challenges that we face. An unrelenting stint at work, relationship difficulties or receiving bad news are just some of the many life challenges that can lead to sleepless nights.

It’s no surprise that stressful life events are associated with disturbed sleep. The way we respond to sleeplessness in terms of our thoughts and behaviours can then perpetuate the problem – it’s not helpful to lie in bed awake willing ourselves to sleep, or to catastrophise about our sleeplessness.

Studies focusing on large numbers of twin pairs back up the idea that environmental influences are an important explanation for why sleep quality differs between one person and another. But they also highlight that sleep problems run in families: if you struggle with your sleep, perhaps your parents or grandparents did too. Looking at why this might be, it seems that our genes are important when it comes to our aptitude for sleeping soundly.

We’re learning more all the time about which specific genes might be important, as I explore in Nodding Off, my new book on the science of sleep. Some more recent research into this has been conducted on a vast scale. For example, one study of over a million people identified genetic variants associated with insomnia, enriching our knowledge of the biological pathways by which insomnia develops.

Read more: Insomnia is not just in the mind

The complexity of the underlying causes of sleep problems goes further than this, and it’s been proposed for some time that genes and the environment go hand-in-hand. For example, some people are more likely to be exposed to certain environmental experiences (such as work stresses) in part for genetic reasons. Their sensitivity to these experiences (such as whether they will keep them up at night) is also influenced by our genes. Another example of genetic and environmental interplay is epigenetics, which means “above genetics”. Our genes do not change, but how they influence us (whether they are “switched on or off” or “turned up or down” like a dimmer switch) can be influenced by the environment.

Can it be fixed?

So what does this all mean for resolving a sleep problem? You may think that the discovery that genes explain some of the differences between us in terms of our sleep quality means that some of us are destined to sleep poorly and there is nothing much we can do about it. But, thankfully, that does not follow.

One of the very first lessons that a student of behavioural genetics learns is that just because something is influenced by our genes does not mean that changing the environment can’t be the solution. The example so often given is that of phenylketonuria (PKU). This is a disorder in which the substance phenylalanine (found in certain foods) can’t be broken down by the body and can lead to brain damage. While this is a genetic disorder, the solution lies in the environment: by carefully considering diet, the negative effects of this disorder can be prevented from developing.

It’s clear that cognitive behavioural therapy for insomnia (CBT-I) which addresses thoughts about sleep, as well as behaviour (including a relaxation component and making sure people do not spend time in bed awake) is the best initial treatment for those who suffer from chronic insomnia.

But understanding more about differences between people might also eventually be useful when it comes to treatment. There is current research interest in personalised medicine, with the hope that treatment can eventually be further tailored to the individual.

Read more: Personalised medicine: how science is using the genetics of disease to make drugs better

Nobody should feel that sleeplessness is something they simply have to endure. If you are struggling with sleep problems, talk to a doctor and try to reach a sleep expert. Different CBT-I online courses are being developed and tested and some appear to be helpful. Despite an array of different causes of sleeplessness, there is help at hand for a better night.