The paucity of selective agonists for TWIK-related acid-sensitive K 3 (TASK-3) channel, a member of two-pore domain K (K2P) channels, has contributed to our limited understanding of its biological functions. By targeting a druggable transmembrane cavity using a structure-based drug design approach, we discovered a biguanide compound, CHET3, as a highly selective allosteric activator for TASK-3-containing K2P channels, including TASK-3 homomers and TASK-3/TASK-1 heteromers. CHET3 displayed potent analgesic effects in vivo in a variety of acute and chronic pain models in rodents that could be abolished pharmacologically or by genetic ablation of TASK-3. We further found that TASK-3-containing channels anatomically define a unique population of small-sized, transient receptor potential cation channel subfamily M member 8 (TRPM8)-, transient receptor potential cation channel subfamily V member 1 (TRPV1)-, or tyrosine hydroxylase (TH)-positive nociceptive sensory neurons and functionally regulate their membrane excitability, supporting CHET3 analgesic effects in thermal hyperalgesia and mechanical allodynia under chronic pain. Overall, our proof-of-concept study reveals TASK-3-containing K2P channels as a druggable target for treating pain.