The σ2 receptor is a poorly understood transmembrane receptor that has attracted intense interest in many areas of biology including cancer imaging, Alzheimer's disease, schizophrenia, and neuropathic pain. However, little is known regarding the molecular details of the receptor, and few highly selective ligands are available. Here, we report the crystal structure of the σ2 receptor in complex with the clinical drug candidate roluperidone and the probe compound PB28. These structures, in turn, templated a large-scale docking screen of 490 million make-on-demand molecules. Of these, 484 compounds were synthesized and tested, prioritizing not only high-ranking docked molecules, but also those with mediocre and poor scores. Overall, 127 compounds with binding affinities superior to 1 μM were identified, all in new chemotypes, 31 of which had affinities superior to 50 nM. Intriguingly, hit rate fell smoothly and monotonically with docking score. Seeking to develop selective and biologically active probe molecules, we optimized three of the original docking hits for potency and for selectivity, achieving affinities in the 3 to 48 nM range and to up to 250-fold selectivity vs. the σ1 receptor. Crystal structures of the newly discovered ligands bound to the σ2 receptor were subsequently determined, confirming the docked poses. To investigate the contribution of the σ2 receptor in pain processing, and to distinguish it from the contribution of the σ1 receptor, two potent σ2-selective and one potent σ1/σ2 non-selective ligand were tested for efficacy in a mouse model of neuropathic pain. All three ligands demonstrated time-dependent decreases in mechanical hypersensitivity in the spared nerve injury model, supporting a role for the σ2 receptor in nociception, and a possible role for σ1/σ2 polypharmacology. This study illustrates the opportunities for rapid discovery of in vivo active and selective probes to study under-explored areas of biology using structure-based screens of diverse, ultra-large libraries following the elucidation of protein structures.