Based on field outcrop observations and microscopic thin section analysis, the microfacies types, microfacies associations, and the evolution of sedimentary environments controlled by relative sea-level changes of the oil and gas reservoirs in the western Ordos Basin are studied. The results show that 13 types of microfacies (MF) can be identified in the Middle-Upper Cambrian of the study area, including argillaceous limestone MF, micritic limestone MF, bioclastic wackstone MF, bioclastic packstone MF, wormkalk, oolitic grainstone MF, intraclastic grainstone MF, intraclastic-bioclastic grainstone MF, mictric-fine crystalline dolomite MF, fine-medium crystalline dolomite MF, argillaceous dolomite MF, mudstone MF, and shale MF. The spatial distribution characteristics of microfacies indicate that this set of carbonate rocks has seven types of microfacies associations, representing restricted platform muddy dolomite flats (MA1), restricted platform dolomite flats (MA2), open platform intra-platform shoals (MA3), open platform inter-shoal sea (MA4), platform margin shoals (MA5), upper slope (MA6), and lower slope facies belts (MA7). From bottom to top, the Middle-Upper Cambrian in the study area successively develops MA5, MA6, MA7, MA3, MA4, MA1, and MA2, which correspond to the platform margin shoals, upper slope, lower slope, open platform intra-platform shoals, inter-shoal sea, restricted platform muddy dolomite flats, and dolomite flats. This sequence indicates that the sedimentary environment becomes more restricted vertically from bottom to top, with the water body becoming shallower. Laterally, the sedimentary environment transitions from slope to platform margin, then to open platform, and finally to restricted platform from west to east, representing a change from deep water to shallow water with a gradual increase in water energy. The sedimentary environment changes revealed by microfacies are jointly controlled by relative sea-level fluctuations and tectonic movements: the sedimentary period of the Zhangxia Formation was mainly controlled by sea-level changes, characterized by sea-level rise. The sedimentary period of the Sanshanzi Formation was controlled by both sea-level changes and tectonic movements. The tectonic uplift in the southwestern part of the basin gradually intensified, leading to a significant drop in relative sea level, thus forming the sedimentary environment transition from slope to platform margin, open platform, and restricted platform from bottom to top.