There are few situations more frustrating: After a day spent nodding off at your desk, on the train, and on your couch, you suddenly can't sleep the moment you crawl into bed. It's not that you aren't tired or have insomnia, necessarily. Like a curse designed just to torture you, the sleeplessness only seems to occur when you're in your own bed at home, a.k.a. the place where you'd prefer to do your sleeping.

This maddening problem isn't in your head. According to TIME, many people have more trouble falling asleep in their own beds than they do elsewhere thanks to a phenomenon called learned or conditioned arousal. Conditioned arousal develops when you inadvertently train your body to associate your bed with being awake. In many cases, this results from doing stimulating activities in bed. For instance: If you like to slip under the covers and spend 40 minutes watching Netflix before closing your eyes, you're teaching your brain that your bed isn't for sleeping. That means the next time your head hits the pillow, your body will respond by preparing for the next episode of Friends instead of releasing the chemicals that help you fall asleep. The same goes for scrolling through apps, eating, and even reading in bed.

Doing things that aren't sleeping in bed isn't the only way to develop conditioned arousal. If there are other factors keeping you up at night—like thoughts about your day, or that cup of coffee you had at 8 p.m.—they can lead to the same result. Your brain starts to associate being in bed with tossing and turning all night, so even if those mental and physical stimulants go away, the muscle memory of being awake in bed remains.

Conditioned arousal is a vicious cycle that can't be broken in one night. The only way to manage it, according to the American Psychological Association (APA), is to minimize behaviors that contribute to poor sleep habits and to reserve your bed for sleeping (though sex is OK, according to the APA).

If you're a nighttime scroller, browse apps in a different room before getting into bed, or skip checking your phone at the end of the day altogether. When you spend more than 20 minutes struggling to fall asleep in bed, get up and move to a different part of the house until you get sleepy again; this will stop your brain from strengthening the association between your bed and feeling restless. The results won't be instant, but by sticking to a new sleep routine, you should eventually train your body to follow healthier patterns.

Of course, combating conditioned arousal alone isn't always effective. In people with conditions like anxiety and insomnia, intrusive thoughts and genetic factors can prevent them from falling asleep even under ideal circumstances. In such cases, the help of a medical professional may be required to sleep more soundly.

Have you got a Big Question you'd like us to answer? If so, let us know by emailing us at bigquestions@mentalfloss.com.