Altered motility of the gallbladder can result in gallstone and cholecystitis, which are important risk factor for biliary tract cancer. Motilin (MLN) and somatostatin (SST) are known important modulators of gallbladder motility. To determine whether genetic variants in motilin, somatostatin, and their receptor genes are associated with the risk of biliary tract cancers and stones, nine tag-SNPs were determined in 439 biliary tract cancer cases (253 gallbladder, 133 extrahepatic bile duct and 53 ampulla of Vater cancer cases), 429 biliary stone cases, and 447 population controls in a population-based case-control study in Shanghai, China. We found that subjects with the rs9568169 AA genotype and rs169068 CC genotype were significantly associated with risk of extrahepatic bile duct cancer (OR =0.49, 95% CI: 0.27-0.89; OR =2.40, 95% CI: 1.13-5.13) compared to the major genotypes. rs2281820 CT and rs3793079 AT genotypes had significantly increased risks of gallstones (OR =1.52, 95% CI: 1.06-2.18; OR =1.64, 95% CI: 1.20-2.25) compared to TT genotypes. Besides, Haplotype analysis showed that T-T-T haplotype (rs2281820-rs3793079-rs2281819) had a non-significantly elevated risk of gallstone (OR =1.30, 95% CI: 0.91-1.86) compared with C-A-A haplotype. To the best of our knowledge, this is the first study to report an association between genetic polymorphisms in , and their receptor genes and risk of biliary tract cancers and stones.