Bed bugs first evolved into existence more than 100 million years ago, new science reveals, meaning the insects would have breathed the same air as Tyrannosaurus rex and other dinosaurs of the Cretaceous Period.

The new study suggests bats, which initially emerged 50-60 million years ago, weren't in fact the first animals to host bed bugs, as had previously been thought. Bed bugs actually predate bats by around 50 million years, it turns out.

That's based on an extensive analysis of modern-day bed bug DNA, taken from 34 species across the world. By building a bed bug family tree – a molecular phylogeny – and analysing the rate of change of the insect's genes, scientists determined that the creatures may have been around for up to 115 million years.

Ancient fossil records corroborate the DNA evidence and suggest these common parasites have been around for many millions of years more than we originally estimated.

"To think that the pests that live in our beds today evolved more than 100 million years ago and were walking the Earth side by side with dinosaurs was a revelation," says one of the team, entomologist Mike Siva-Jothy from the University of Sheffield in the UK.

"It shows that the evolutionary history of bed bugs is far more complex than we previously thought."

That complexity includes the discoveries that new types of bed bug latch onto humans about once every half a million years, and that bed bugs can evolve to be specialists (feeding off one host) or generalists (feeding off several as they evolve).

"[Evolutionarily] older bed bugs were already specialised on a single host type, even though we don't know what the host was at the time when T. rex walked the earth," says one of the researchers, Steffen Roth from the University Museum Bergen in Norway.

The research also revealed that the type of bed bugs that like to feed on humans – the common bedbug and the tropical bedbug – have been around much longer than we have. In other words, they were lying in wait in caves for a while before humans moved in.

That contrasts with previous thinking based on other types of parasite, like lice, where the evolutionary history can be closely linked to the evolution of their human hosts.

According to the researchers, dinosaurs were unlikely to have been bed bug hosts – bed bugs and insects like them tend to feed off animals that have a home base, like a bird's nest or a bat's roost (or a person's bed).

Though the first bed bug host remains a mystery for now, the researchers hope that this new genetic analysis could reveal some biological weaknesses in the creatures – giving experts a way to control the spread of bed bugs, other similar insects, and the diseases that spread along with them.

"These findings will help us better understand how bed bugs evolved the traits that make them effective pests," says Siva-Jothy. "That will also help us find new ways of controlling them."

The research has been published in Current Biology.