The human gut is the host of a rampant microscopic orgy. To survive, the microbes in our digestive tract are having 'sex' with each other on a regular basis, all in the name of swapping secrets on how to survive deadly doses of antibiotics.

A team of researchers from the University of Illinois at Urbana-Champaign and University of California Riverside has now learned just how far this bacterial bump-and-grind goes, finding exchanges that go beyond what we knew previously.

Bacteria, of course, don't have genitals, but technically 'sex' in biology refers to any process that exchanges genetic material.

By forming a 'temporary union' with another bacterium in our gut, a microbe can therefore transfer its genes to another – it doesn't even have to be the same species.

All the microbe has to do is stick out a tube, called a pilus, and attach itself to another cell, shooting off a transferable package of DNA called a mobile genetic element when it's ready.

The discovery of bacterial sex was made over 70 years ago, when scientists realized this horizontal gene transfer was how microbes were sharing resistance genes for certain antibiotics, thereby spreading antibiotic resistance.

More recently, it's become clear that bacterial sex doesn't just occur when microbes are under attack. It happens all the time, and it's probably part of what keeps our microbiome fit and healthy.

New research has now identified what genes bacteria are actually sharing when they do this.

The study was conducted among a phylum of gut microbes, called Bacteroidetes, which comprise up to 80 percent of the human microbiome and are important digesters.

"The big, long molecules from sweet potatoes, beans, whole grains, and vegetables would pass through our bodies entirely without these bacteria," explains microbiologist Patrick Degnan from the University of California Riverside.

"They break those down so we can get energy from them."

To colonize the human gut and help us break down carbohydrates, however, these microbes must compete for limited resources in the large intestine. Such resources include vitamin B12 and other related compounds, which help fuel the bacteria's metabolism and synthesis of proteins.

Most microbes in the gut don't have the ability to synthesize these crucial compounds on their own, which means they have to soak up what they can from their environment.

For this to be effective, it pays to have genes for an efficient vitamin B12 transport system at the ready.

In both petri dishes and in living mouse models, researchers have now identified B12 transporters that are shared via bacterial sex.

"We're excited about this study because it shows that this process isn't only for antibiotic resistance," says Degnan.

"The horizontal gene exchange among microbes is likely used for anything that increases their ability to survive, including sharing [genes for the transport of] vitamin B12."

When two gut microbes were placed on a dish in the lab, researchers noticed the bacterium that couldn't synthesize B12 transport systems connected up with the bacterium that could. Once the sex pilus bridged the gap between the two, the 'receiving' bacterium could unpack its precious cargo.

After the experiment, researchers examined the genome of the receiving bacterium, which was still alive, and found it had incorporated an extra band of DNA from the donor.

Among living mice, something similar appears to happen. When researchers administered two forms of Bacteroidetes to a mouse – one that possessed the genes for transferring B12, and another that didn't – they found the genes of the former had 'jumped' to the latter after five to nine days.

"It's as if two humans had sex, and now they both have red hair," says Degnan.

Interestingly, the authors note that a secondary round of gene transfer, between Bacteroidetes of the same species, occurred slightly faster than the first round, which was between two different species.

The findings suggest there may be a slight 'species barrier' when it comes to bacterial sex. Although, that barrier is nothing like what we see with mammals, where a species can only reproduce with another of its kind.

Bacteria, it seems, aren't nearly so picky about their partners, and our stomachs are very grateful for their promiscuity.

The study was published in Cell Reports.