Greenhouses offer controlled microclimates that enable year-round cultivation, improving food security and agricultural productivity. However, greenhouses are energy-intensive, with heating accounting for a significant portion of the associated costs. This study explores optimal microgrid configurations, economic viability, and policy recommendations for sustainable greenhouse agriculture in Nigeria. An in-depth energy assessment of a reference greenhouse in a South Korean facility is conducted. Distinct climatic differences between South Korea and Nigeria are highlighted, emphasizing the need for tailored greenhouse designs and energy solutions. Shifting focus to Nigeria, this study investigates the feasibility of hybrid renewable energy systems with a focus on wind and solar power across six geopolitical zones in Nigeria. The analysis encompasses technical, economic, and policy aspects, providing a holistic perspective on renewable energy adoption. Notably, the study uses an advanced optimization model, Teaching and Learning–Based Optimization algorithm, to assess the net present cost and baseload supply reliability, offering valuable insights for investors and policymakers. The result indicates diverse energy requirements across Nigeria, with total monthly peak energy demands ranging from 5374.80 kWh in the Southeast to 17,115.76 kWh in the Northwest, and a notable variation in the Levelized Cost of Electricity (LCOE), with the lowest at $0.07327 in Kano. Specifically, in Ogun, the net present cost for the WT-PV-ESS system stood at $520,935.45, while the PV-ESS system cost was substantially lower at $500,444.41. This confirms the effectiveness of location-specific analysis and shows the suitability of photovoltaic–battery energy storage systems for Nigeria's diverse regions, with unique considerations for specific areas. Policy recommendations, including feed-in tariffs, renewable portfolio standards, net metering, research support, and market development, provide a holistic framework for the adoption of renewable energy and sustainable agriculture. Improving infrastructure, market access, and financing for smallholder farmers is integral for improving food security and standards of living in rural Nigeria. In conclusion, Nigeria can leverage renewable resources to revolutionize its energy and agriculture sectors, setting an example for a sustainable and resilient future.