CRISPR-based gene drives offer promising means to reduce the burden of pests and vector-borne diseases. These techniques consist of releasing genetically modified organisms carrying CRISPR-Cas nucleases designed to bias their inheritance and rapidly propagate desired modifications. These can be intended to reduce reproductive capacity of harmful insects or spread anti-pathogen effectors through wild populations, even when these confer fitness disadvantages. Technologies capable of halting the spread of gene drives may prove highly valuable in controlling, counteracting, and even reverting their effect on individual organisms and even entire populations. Here we show engineering and testing of a novel genetic approach, based on the germline expression of a phage-derived anti-CRISPR protein (AcrIIA4), able to inactivate CRISPR-based gene drives and restore their inheritance to mendelian rates in the malaria vector Anopheles gambiae. Our modeling predictions and cage testing show that a single release of male mosquitoes carrying the AcrIIA4 protein can block the spread of a highly effective suppressive gene drive and prevent population collapse of caged malaria mosquitoes.