Lacustrine sedimentary formations potentially contain hydrocarbons. The lacustrine sedimentary rocks of the Ziliujung and Xintiangou Formations have been investigated for their hydrocarbon potential using low-pressure nitrogen adsorption (LP-N2A), low-field nuclear magnetic resonance (NMR), scanning electron microscopy (SEM), total organic carbon (TOC), rock-eval pyrolysis (Rock-Eval), gas chromatography (GC), gas chromatography–mass spectrometry (GC–MS), X-ray fluorescence spectrometry (XRF), and inductively coupled plasma mass spectrometry (ICP-MS). The results show that the normalized difference of the pore parameters between the two formations is less than 10%, and the pores are mainly slit-like mesopores with high porosity. Macropores and micropores are often developed in the quartz skeleton, while mesopores often occur among organic matter, clay minerals, carbonate minerals, and pyrite particles. The organic matter abundance of the Ziliujing Formation is relatively high. Additionally, the organic matter types of the two formations are mainly type II and type III, and the sources of the organic matter are plankton and bacteria which have reached the mature gas production stage. The palaeoenvironmental differences between the depositional periods of the two formations lie within 10% of each other. The warm and humid climate promotes the development of quartz minerals to further enhance the proportion of both micropores and macropores, and the clay minerals, carbonate minerals, and pyrite carried in the terrigenous detritus are closely associated with the total organic carbon (TOC), which promotes the development of mesopores to enhance the porosity. The reservoir, organic matter, and palaeoenvironmental characteristics of fine-grained sedimentary rocks in the two formations are similar, and both of them have good potential for development. The above results provide a basic geological theoretical basis for unconventional oil and gas exploration in the northeastern margin of the Sichuan Basin.