Greenhouse technology presents a promising solution to the challenges of agricultural productivity and sustainability, particularly for small-scale farmers facing climate change, resource constraints, and unpredictable weather conditions. This study was the first attempt to investigate the impact of greenhouse adoption on farmers’ welfare which focused on household income per capita and food security status. The samples of this study were conducted 201 melon farmers in East Java, Indonesia. This study analyzed data to discern the effects of greenhouse adoption on farmers’ welfare by employing endogenous switching regression to address potential endogeneity issues. The analysis revealed that greenhouse adoption significantly and positively affected household income per capita and food security status. Through rigorous data analysis, this research had contributed valuable insights into the socio-economic implications of adopting greenhouses in agricultural practices. The results highlighted the role of greenhouses in boosting farmers’ resilience, improving livelihoods, and enhancing food security, providing a strong case for promoting greenhouse technology in rural agricultural practices.