Evolutionary expansion of signaling pathway families often underlies the evolution of regulatory complexity. Expansion requires the acquisition of a novel homologous pathway and the diversification of pathway specificity. Acquisition can occur either vertically, by duplication, or through horizontal transfer, while divergence of specificity is thought to occur through a promiscuous protein intermediate. The way by which these mechanisms shape the evolution of rapidly diverging signaling families is unclear. Here, we examine this question using the highly diversified Rap-Phr cell-cell signaling system, which has undergone massive expansion in the genus Bacillus. To this end, genomic sequence analysis of >300 Bacilli genomes was combined with experimental analysis of the interaction of Rap receptors with Phr autoinducers and downstream targets. Rap-Phr expansion is shown to have occurred independently in multiple Bacillus lineages, with >80 different putative rap-phr alleles evolving in the Bacillius subtilis group alone. The specificity of many rap-phr alleles and the rapid gain and loss of Rap targets are experimentally demonstrated. Strikingly, both horizontal and vertical processes were shown to participate in this expansion, each with a distinct role. Horizontal gene transfer governs the acquisition of already diverged rap-phr alleles, while intralocus duplication and divergence of the phr gene create the promiscuous intermediate required for the divergence of Rap-Phr specificity. Our results suggest a novel role for transient gene duplication and divergence during evolutionary shifts in specificity.