The Nb-Ta-Zr-Hf-REY-Ga mineralization in the Late Permian coals in southwestern China has been well investigated by several studies and has generally been attributed to alkaline pyroclastics coupled with input from hydrothermal fluids. The Late Triassic is one of the important coal-forming periods but the critical element mineralization in coals of this geological age has not been well documented. In this paper, the mechanism of Nb-Ta-Zr-Hf-REE-Ga-Th-U mineralization in the K5 coal seam of the Upper Triassic Xujiahe Formation from the Gaosheng Mine, Sichuan Basin, southwestern China, was investigated. The K5 coal is a high-ash, low-sulfur, and low-volatile bituminous coal. The minerals in this coal include illite, kaolinite, quartz, and, to a lesser extent, anatase, calcite, chamosite, bassanite, and pyrite, along with traces of ankerite, rutile, and zircon. Compared with the averages of common world hard coals, the studied coals are enriched in critical elements including Zr (247 ppm), Hf (5.56 ppm), Nb (23 ppm), Ta (1.55 ppm), rare earth elements and yttrium (REY, 168 ppm), Ga (18.3 ppm), Th (14.1 ppm), and U (6.18 ppm) (all on a whole coal basis). The Al2O3/TiO2 ratios, Eu anomalies, and the relationships of Al2O3/TiO2 vs. Zr/TiO2 and Nb/Yb suggest that the sediment-source rocks of the Gaosheng coals were Neoproterozoic and Early-Middle Triassic felsic-intermediate igneous rocks from the southeastern Qinling and Longmenshan Orogens, along with the Hannan and Micangshan-Dabashan Uplifts. Other probable sources are contemporaneous felsic-intermediate pyroclastics from the Late Triassic volcanic areas around the Sichuan Basin (i.e., East Kunlun Orogen, West Qinling Orogen, and East Tibetan Plateau). The relationships of Al2O3/TiO2 vs. Zr/Al2O3, Al2O3/TiO2 vs. Nb/Al2O3, Ga/Al2O3, and Al2O3/TiO2 vs. LREY/Al2O3 further indicate that the elevated concentrations of Nb(Ta)-Zr(Hf)-REY-Ga in the Gaosheng coal are probably sourced from both the erosion of sediment-source regions and contemporaneous pyroclastics. The illite-kaolinite aggregates with a vermicular texture and authigenic illite, quartz, anatase, pyrite, calcite, ankerite, barite, and REE-rich minerals, REY distribution patterns, as well as elemental variation trends of the coal seam, collectively indicate that the studied coals were likely influenced by multiple-stage infiltration of various solutions. These solutions leached the fresh pyroclastics and products of erosion derived from granites in the sediment-source regions, leading to redistribution of the critical elements (e.g., Zr, Nb, and HREY) between the roof, floor, and parting mudstones and the coal benches. The concentrations of (Nb,Ta)2O5, (Zr,Hf)2O5, and Ga in the coals are 107, 1093, and 57.6 ppm, respectively, close to or higher than the marginal grade of conventional ore deposits for these elements, and thus the Gaosheng coals have potential as raw materials for the recovery of the critical metals Nb, Ta, Zr, Hf, and Ga.