Different forms of sleep disorders have become major health problems among people around the world, and insomnia is one of them. It is a physical condition in which a person faces difficulties to fall asleep at night. It leads to various mental disorders, like anxiety and depression. One of the vital causes of substance abuse is insomnia. This study has proposed a machine learning approach to predict insomnia using different socio-demographic factors of the participants. A multilayer stacking model has been employed in this study to predict the appearance of insomnia in a person. For feature reduction, Principal Component Analysis (PCA) has been used. Our proposed ensemble model has attained an accuracy of 88.60%. The effectiveness of our proposed model has been compared to that of other state-of-the-art ensemble classifiers, like AdaBoost, Gradient Boost, Bagging, and Weighted Voting classifier. The proposed model stated in this study has surpassed the performance of the other ensemble classifiers in terms of different efficacy metrics, like sensitivity, precision, specificity, area under the curve (AUC), accuracy, and F1-score.