Negative δ34S values of sedimentary pyrite associated with organic matter are routinely assumed to be the result of biogenic process. However, the distribution and evolution of isotopic values mediated by bacteria across sedimentary strata remains poorly understood. Abundant pyrite-rich nodules (PyRNs) are distributed in the bottom of the sandstone unconformably overlying the coal in middle Jurassic strata in the northeastern Ordos Basin, providing a good opportunity to quantitatively characterize the distribution, morphology and compositions of sulfur isotope and trace element of pyrite in the sandstone influenced by organic matter in the coal. A total of 1007 PyRNs occurs within a range of 4 m from the coal. From bottom to top in the sandstone, the shape of the nodule changes from oval to round on the vertical section, and the length and number gradually decrease at the rate of ~45 mm and ~ 228 for every 1 m increasing in distance, respectively. Microscopically, pyrite occurs as euhedral crystals, and trace element mapping reveals multistage growth (up to a dozen times) and a marked compositional zoning with respect to Co, Ni, As, Se and Mo. The positive correlation between Co and Ni, with ratios of Co/Ni ranging from 0.06 to 0.45, indicates that Fe and those trace elements are sourced from diagenetic fluid. The organic sulfur in coal, serving as a sulfur source, is reduced by bacteria to generate H232S at slow reduction rate. The H232S migrates upwards and reacts with Fe to form pyrite in the sandstone, resulted in extremely low δ34S values (from −53.9 to −43.1 ‰), which gradual decrease both from core to margin in individual grain and at the rate of 2.2 to 8.8 ‰ for every 1 m increasing in distance away from the coal. This study highlights the significant variability of mineralogical (e.g., number, size, morphology) and geochemical (trace elements, sulfur isotope) characteristics of sedimentary pyrite. Results allow the relation of multistage growth of pyrite to biogenic fractionation, and provide fresh insights into biogenically derived sulfur from coals to be fixed in sandstones, which can be applied to quantitative characterization of formation processes of sedimentary minerals controlled by organic matter in sedimentary environments worldwide.