Breakthroughs have been made for the natural gas exploration of the Middle Devonian and the Middle Permian formations in the Sichuan Basin in recent years. Nevertheless, its natural gas source is still not clear, which then affects the next exploration deployment decision. A comprehensive study is conducted on the geochemical characteristics of the Middle Devonian and the Middle Permian natural gas, the biomarkers of reservoir bitumen, and the source rocks. The results show that these natural gases are secondary cracking dry gas that includes more than 86% of methane content, a small amount of ethane, propane, and a non-hydrocarbon gas (e.g., nitrogen, carbon dioxide, and hydrogen sulfide). The natural gas maturity varies slightly in different regions. The carbon and hydrogen isotope values of natural gas are as follows: δ13C1 ranges from −35.7‰ to −27.3‰, δ13C2 ranges from −38.7‰ to −26.6‰, δ13C3 ranges from −37‰ to −26.5‰, δ2HCH4 ranges from −141‰ to −138‰, and δ2HC2H6 ranges from −164‰ to −112‰. The isotope values indicate that the genetic type of natural gas is the sapropelic type and the mixture type is dominated by sapropelic type. The difference between natural gas values of δ13C1, δ13C2, and δ2HCH4 in different regions is related to the contribution ratio of source rocks from different ages. The gases of the Middle Devonian and the Middle Permian of the Shuangyushi structure in Northwestern Sichuan, the Middle Permian of Southwestern Sichuan, and the Middle Permian of Paleo-uplift in Central Sichuan are mainly derived from the Cambrian Qiongzhusi Formation and the Middle-Lower Permian source rocks. The Middle-Upper Permian natural gases of the volcanic reservoir in Southwestern Sichuan is mainly from the Qiongzhusi source rock. The Middle Permian natural gases of the Hewanchang structure in Northwestern Sichuan, Eastern Sichuan, and Southern Sichuan are mainly derived from the Silurian Longmaxi source rock. The research results have important guiding significance for developing exploration and deployment solutions for natural gas of the Middle Devonian and the Middle Permian formation in the Sichuan Basin.