The reservoir of the upper Triassic Xujiahe Formation (T3x) in the Western Sichuan Foreland Basin is a set of terrigenous clastic rocks in an environment of coal measure sediments. Diagenesis greatly controls the physical properties of the reservoir through different responses of minerals to acidic and alkaline diagenetic environment. The dissolution of unstable components such as feldspar, rock fragments, carbonate cement, and clay minerals is the major source of secondary pores under acidic diagenesis, while the dissolution of quartz increases the reservoir space in the fault-fold zone of Longmen Mountain and Leikoupo paleo-hills. The dissolution of quartz is a result of cross-formation flow of fluid in the Himalaya epoch and the invasion of alkaline formation water from the Triassic Leikoupo and Jialingjiang formations through fault and fracture systems. In the vertical succession, acidic dissolution occurs at a shallow depth of less than 2,180 m, and alkaline dissolution occurs at a greater depth of more than 2,280 m. The reservoir space is formed by the influence of both acidic and alkaline dissolution in the depth interval of 2,180–2,280 m.