Recently, it has become clear that most bacteria produce and uptake extracellular vesicles. These vesicles contain multiple types of biological cargo, including proteins and genetic material. Vesicles facilitate the horizontal exchange of DNA between cells. Vesicle-mediated gene exchange complements the three classic mechanisms of horizontal gene transfer within bacteria: transduction, transformation, and conjugation. Unlike these more well-established mechanisms of gene transfer, little is known about the regulation of gene exchange in vesicles. In our experiments, we identify the parameters that control the production, composition, and exchange of extracellular vesicles containing DNA within multispecies populations. Gene transfer rates depended on characteristics of the transferred DNA as well as the identities of both the donor and acceptor bacteria. From these measurements, we developed a model of horizontal gene transfer within microbial ecosystems that incorporates all four mechanisms of exchange. The model suggests that vesicle-mediated gene transfer has important consequences in shaping the gene flow patterns in microbial ecosystems.