Gene transfer agents (GTAs) are enigmatic elements that resemble small viruses and are known to be produced during nutritional stress by some bacteria and archaea. The production of GTAs is regulated by quorum sensing, under which a small fraction of the population acts as GTA producers, while the rest become GTA recipients. In contrast to canonical viruses, GTAs cannot propagate themselves because they package random pieces of the producing cell's genome. In alphaproteobacteria, GTAs are mostly vertically inherited and reside in their hosts' genomes for hundreds of millions of years. While GTAs' ability to transfer genetic material within a population and their long-term preservation suggests an increased fitness of GTA-producing microbes, the associated benefits and type of selection that maintains GTAs are poorly understood. By comparing rates of evolutionary change in GTA genes to the rates in gene families abundantly present across 293 alphaproteobacterial genomes, we detected 59 gene families that likely co-evolve with GTA genes. These gene families are predominantly involved in stress response, DNA repair, and biofilm formation. We hypothesize that biofilm formation enables the physical proximity of GTA-producing cells, limiting GTA-derived benefits only to a group of closely related cells. We further conjecture that population structure of biofilm-forming sub-populations ensures that the trait of GTA production is maintained despite the inevitable rise of "cheating" genotypes. Because release of GTA particles kills the producing cell, maintenance of GTAs is an exciting example of social evolution in a microbial population.