This paper introduces an optimized deep neural network (DNN) framework for an efficient gas detection system applicable across various settings. The proposed optimized DNN model addresses key issues in conventional machine learning (ML), including slow computation times, convergence issues, and poor adaptability to new data, which can result in increased prediction errors and reduced reliability. The proposed framework methodology comprises four phases: data collection, pre-processing, offline DNN training optimization, and online model testing and deployment. The training datasets are collected from seven classes of liquid beverages and environmental air samples using integrated gas sensor devices and an edge intelligence environment. The proposed DNN algorithm is trained on high-performance computing systems by fine-tuning multiple hyperparameter optimization techniques, resulting in an optimized DNN. This well-trained DNN model is validated using unseen new testing datasets in high-performance computing systems. Experimental results demonstrate that the optimized DNN can accurately recognize different beverages, achieving an impressive detection accuracy rate of 98.29%. The findings indicate that the proposed system significantly enhances gas identification capabilities and effectively addresses the slow computation and performance issues associated with traditional ML methods. This work highlights the potential of optimized DNNs to provide reliable and efficient contactless detection solutions across various industries, enhancing real-time gas detection applications.