Stress has a remarkable impact on various cognitive functions, demanding timely and effective detection using strategies deployed across interdisciplinary domains. It influences decision-making, attention, learning, and problem-solving abilities. As a result, stress detection and modeling have become important areas of study in both psychology and computer science. This study links the fields of psychology and machine learning to deal with the urgent requirement of accurate stress detection methodologies and highlights sleep patterns as a key indicator for stress detection, discussing a novel approach to understand and determine stress levels. Psychologists use affective states to measure stress, which refers to a sense of feeling an underlying emotional state. However, most stress classification work has been limited to user-dependent models, which new users cannot use without additional training. This can be a significant time burden for new users trying to predict their affective states. Therefore, it is critical to address basic mental health issues in children and adults to prevent them from developing more complex problems on account of undergoing stress. The medical field processes vast amounts of medical data; the machine learning algorithms sift through patterns that might escape the human eye. The machine learning algorithms act as detectives, able to spot correlations and bring out a sense of complex information. The machine learning algorithms reveal fine correlations and patterns, aiding in more precise and prompt diagnoses particularly to focus fundamental mental health issues in individuals of all ages. This research work deploys an enhanced Multilayer Perceptron (MLP), exhibiting an extensive feature analysis for processing medical datasets, resulting in improved effectiveness in predicting stress levels. This helps us to diagnose issues more accurately and swiftly which improves the patient outcomes. The proposed and enhanced MLP model undergoes stringent evaluation and its performance metrics are measured as Accuracy 99%, Precision 98.6%, Recall 99%, and F1-Score 99.5% compared against existing competent machine learning algorithms that include Adaboost, Random Forest, Gradient Boosting, and Decision Tree for different stress levels undertaken. The results show that MLP provides best results of accuracy compared with existing machine learning techniques in identifying stress detection via sleep patterns. © The Institution of Engineers (India) 2024.