Gastric intestinal metaplasia (IM) induced by bile acid is a precancerous lesion of gastric adenocarcinoma and is associated with the expression of caudal-related homeobox 2 (CDX2). In the present study, the role of farnesoid X receptor (FXR) on the regulation of CDX2 in gastric cells was investigated and the underlying molecular mechanisms were examined. Human gastric cell lines were treated with chenodeoxycholic acid (CDCA) or FXR agonist GW4064. Cells were treated with CDCA in the presence or absence of the FXR antagonist or FXR siRNA transfection. Next, cells were treated with CDCA in the presence or absence of SHP siRNA transfection and FXR, CDX2 and SHP mRNA and protein levels were determined by reverse transcription-quantitative polymerase chain reaction and western blot analysis. A chromatin immunoprecipitation assay was performed to examine the relationship between FXR and SHP and the expressions of FXR and CDX2 in gastritis and IM tissues were detected using immunohistochemistry. The results revealed that CDCA was able to induce CDX2 expression, which could be blocked by inhibition or knockdown of FXR. Mechanistically, FXR directly induced the expression of small heterodimer partner (SHP). SHP knockdown significantly decreased CDCA-induced CDX2 expression. ChIP results indicated that FXR could directly bind SHP promoter and promote SHP expression. Finally, immunohistochemistry results demonstrated that the expression levels of CDX2 and FXR in human IM lesions were significantly higher, compared with those in gastritis lesions, and were positively correlated. Collectively, these results revealed that the activation of FXR and sequential direct transcriptional induction of SHP were involved in the expression of CDX2 induced by bile acid in gastric IM lesions.