Quantitative petrographic analysis revealed the diagenetic controls on the reservoir quality of deep (>5,000 m) carbonate reservoirs in the Tarim Basin. Dolostones were formed by the extensive dolomitization of originally low-energy (siliciclastic mudrocks, calcimudstones, and wackestones) and moderate-to-high-energy (peloidal, intraclastic, and/or bioclastic packstones to grainstones, rarely microbialites) deposits. Replacement of primary and diagenetic constituents by dolomite occurred in multiple phases. Eogenetic dolomitization precipitated microcrystalline to finely crystalline dolomite, followed by dolomite overgrowth during shallow mesogenesis. Saddle, coarse, and radial undulose dolomite precipitated during deep mesogenesis under increasing temperature and pressure and were locally replaced by microcrystalline quartz. Primary porosity is absent, but these carbonates can display vuggy, intercrystalline, and fracture porosity due to dolomite dissolution and local fracturing. Secondary porosity can be partially or totally filled by saddle dolomite and/or quartz. Petrological and fluid-inclusion data indicated that three ascending fluids considerably influenced the diagenetic evolution and quality of the Cambrian reservoirs, namely, organic acid-rich fluids from the maturation of source rocks, SO2-rich fluids derived from the dissolution of calcium sulfate and hydrothermal fluids. The structurally controlled percolation of SO2-rich fluids was the main process responsible for creating porosity in deep carbonate reservoirs in the Tarim Basin. The influence of hydrothermal fluids is not ubiquitous, and it had a dual impact on reservoir quality, i.e., the hydrothermal fluids enhanced the porosity through dolomite dissolution and decreased the porosity through dolomite and quartz precipitation.