This study investigates the effects of rice straw pretreatment using sodium hydroxide and the addition of molasses as a co-substrate on biogas production through anaerobic fermentation. The pretreatment process involved immersing rice straw in sodium hydroxide solutions at three different concentrations for twenty-four hours, while molasses was added at varying levels to evaluate its effect on the fermentation process. Compositional changes in the lignocellulosic biomass were analyzed using the Chesson–Datta method, which revealed significant alterations in cellulose, hemicellulose, and lignin contents. The lowest sodium hydroxide concentration produced moderate delignification while retaining a relatively high cellulose content, indicating its potential as the optimal pretreatment condition. Molasses addition consistently increased biogas production as dosage levels rose, with the highest yield observed at the maximum molasses concentration. The combined application of the lowest sodium hydroxide concentration and the highest molasses level resulted in the maximum biogas yield, demonstrating improved substrate biodegradability and fermentation efficiency. These findings highlight the practical potential of integrating NaOH pretreatment with molasses co-substrate addition to enhance the conversion efficiency of lignocellulosic agricultural waste into renewable energy through anaerobic fermentation.