CRISPR-Cas systems in bacteria and archaea provide immunity against bacteriophages and plasmids. To overcome CRISPR immunity, phages have acquired anti-CRISPR genes that reduce CRISPR-Cas activity. Using a synthetic genetic circuit, we developed a high-throughput approach to discover anti-CRISPR genes from metagenomic libraries based on their functional activity rather than sequence homology or genetic context. We identified 11 DNA fragments from soil, animal, and human metagenomes that circumvent Streptococcus pyogenes Cas9 activity in our selection strain. Further in vivo and in vitro characterization of a subset of these hits validated the activity of four anti-CRISPRs. Notably, homologs of some of these anti-CRISPRs were detected in seven different phyla, namely Firmicutes, Proteobacteria, Bacteroidetes, Actinobacteria, Cyanobacteria, Spirochaetes, and Balneolaeota, and have high sequence identity suggesting recent horizontal gene transfer. Thus, anti-CRISPRs against type II-A CRISPR-Cas systems are widely distributed across bacterial phyla, suggesting a more complex ecological role than previously appreciated.