5-HT7R belongs to a family of G protein-coupled receptors and is associated with a variety of physiological processes in the central nervous system via the activation of the neurotransmitter serotonin (5-HT). To develop selective and biased 5-HT7R ligands, we designed and synthesized a series of pyrazolyl-diazepanes 2 and pyrazolyl-piperazines 3, which were evaluated for binding affinities to 5-HTR subtypes and functional selectivity for G protein and β-arrestin signaling pathways of 5-HT7R. Among them, 1-(3-(3-chlorophenyl)-1H-pyrazol-4-yl)-1,4-diazepane 2c showed the best binding affinity for 5-HT7R and selectivity over other 5-HTR subtypes. It was also revealed as a G protein-biased antagonist. The self-grooming behavior test was performed with 2c in vivo with Shank3-/- transgenic (TG) mice, wherein 2c significantly reduced self-grooming duration time to the level of wild-type mice. The results suggest that 5-HT7R could be a potential therapeutic target for treating autism spectrum disorder stereotypy.