Acid sensing ion channels (ASICs) are proton-gated ion channels that function as primary acid sensors in mammalian neurons. The ASIC3 subtype is a therapeutic target due to its importance in inflammatory and cardiac pain. The sea anemone peptide APETx2 is the most potent and selective ASIC3 inhibitor described to date, and it is analgesic in rodent models of pain. Nevertheless, little is known about the pharmacophore of APETx2, its binding site on ASIC3, and its mechanism of action. Here we present the first detailed structure-activity relationship study of APETx2. Determination of a high-resolution structure of APETx2 combined with alanine scanning mutagenesis revealed that a cluster of aromatic and basic residues spanning two loops of the peptide is crucial for its interaction with ASIC3. Furthermore, we show for the first time that at low micromolar concentrations, APETx2 also inhibits hERG channels by reducing the maximum current amplitude and shifting the voltage-dependence of activation to more positive potentials. Electrophysiological screening of several APETx2 mutants revealed that there is partial overlap between the binding surfaces on APETx2 that mediate its interaction with ASIC3 and hERG. Characterization of the molecular basis of the APETx2 interaction with ASIC3 and hERG is an important step towards the rational design of more selective and safer novel analgesics based on APETx2.