The design of G-protein-coupled receptor (GPCR) allosteric modulators, an active area of modern pharmaceutical research, has proved challenging because neither the binding modes nor the molecular mechanisms of such drugs are known. Here we determine binding sites, bound conformations and specific drug-receptor interactions for several allosteric modulators of the M2 muscarinic acetylcholine receptor (M2 receptor), a prototypical family A GPCR, using atomic-level simulations in which the modulators spontaneously associate with the receptor. Despite substantial structural diversity, all modulators form cation-π interactions with clusters of aromatic residues in the receptor extracellular vestibule, approximately 15 Å from the classical, 'orthosteric' ligand-binding site. We validate the observed modulator binding modes through radioligand binding experiments on receptor mutants designed, on the basis of our simulations, either to increase or to decrease modulator affinity. Simulations also revealed mechanisms that contribute to positive and negative allosteric modulation of classical ligand binding, including coupled conformational changes of the two binding sites and electrostatic interactions between ligands in these sites. These observations enabled the design of chemical modifications that substantially alter a modulator's allosteric effects. Our findings thus provide a structural basis for the rational design of allosteric modulators targeting muscarinic and possibly other GPCRs.