The Middle−Upper Xixiangchi Formation of the Sichuan Basin consists of mixed carbonates and siliciclastics. The carbonates are dominated by dolomitized lime-mudstones and dolo–grainstones of shallow warm-water environments. Petrographic examination of carbonates reveals two types of dolomite: (i) fabric retentive dolomicrite (D1, micritic to near-micritic, 4–50 μm) and (ii) fabric-destructive dolomite (eu-to subhedral crystals with cloudy cores and clear rims, 50–300 μm). The mean ∑REE values of D1 (15.3 ± 6.3 ppm) and D2 (14.6 ± 7.1 ppm) and the nearly identical mean PAAS-normalized patterns that coincide at some points, suggest an origin from similar parent fluids that were not dramatically changed by water-rock interaction through basinal sedimentary rocks. The estimated Sr/Ca molar ratios of D1 (0.0043–0.0055) parent fluids and their estimated δ18O values imply an origin from a mixture of meteoric and seawaters, which is also consistent with the petrographic evidence. The partially coinciding normalized REE pattern of D2 with that of the earlier D1 suggests that the latter was formed at a mid-burial setting rather than deep burial, which is consistent with higher homogenization temperatures of primary two-phased fluid inclusions retained in D2 (Th = 118.1 ± 5.3 °C). Therefore, D1 is suggested to have formed (1) during a penecontemporaneous period that resulted from a slight evaporative pumping effect within a near-surface diagenetic environment, and/or (2) during post-penecontemporaneous or penecontemporaneous seepage-reflux dolomitization, induced by sea-level fluctuations, during early stages of diagenesis at near-surface conditions. D2 formed likely through the recrystallization of D1 or a continuation of reflux dolomitization of the same precursor at mid-burial rather than deep burial settings.