"Sleep tight, don't let the bed bugs bite," goes the familiar phrase. Unfortunately the statistics aren't in your favour, because these apple-pip-sized bugs are everywhere.

Hardly a week goes by without a news story of yet another infestation, and yet they are relatively understudied, says Warren Booth of the University of Tulsa in Oklahoma, US.

Booth and his colleagues have used genetics to unveil the origin of bed bugs. They found that there are two lineages in Europe. They are so diverse, they have almost split into two species.

What's more, their origin lies with bats.

The research, published in the journal Molecular Ecology, provides the first genetic evidence that bats were the ancestral host of the bed bugs that plague human residences today.

Bed bugs have been around for a long time, as has their association with humans. There are references to them in ancient Egyptian literature, and archaeologists have even discovered what seem to be fossilised bed bugs thought to be about 3,500 years old.

While you sleep at night they are feeding on your blood

A single pregnant female bed bug can infest an entire apartment building and the creatures are able to go through many rounds of inbreeding with no detrimental effects at all. All they need are human hosts to satisfy their thirst.

But in the 1950s they largely disappeared from our homes and hotels, due to an effective pesticide campaign. However, 15 years ago they came back with a vengeance.

Infestations are hard to treat, as 90% of common bed bugs now have a mutation that makes them resistant to the insecticides, known as pyrethroids, used to kill them.

Booth's team sampled hundreds of bed bugs from human and bat dwellings from 13 countries around Europe.

An analysis of their DNA showed that there was no gene flow occurring between the human and bat bed bugs, even though some bats lived in churches or attics and could therefore have come into human contact.

We're living in a time where they're becoming much more common

The bat lineage probably dates back to when bats and humans once shared caves, says Booth. Even today it shows much more genetic diversity than the human form.

So different were the two that when previously bred together in the lab, the offspring were less fertile.

While their bites are not known to spread disease, they can cause itchy bumps and rashes not to mention the stigma of living or coming from an infected area.

"While you sleep at night they are feeding on your blood, you are a meal ticket for them," says Booth. "That can lead to enormous psychological issues."

There's two types of people, says Booth: "the type that have had bed bugs and the people that will still get them. We're living in a time where they're becoming much more common."

Follow Melissa Hogenboom and BBC Earth on Twitter