Insomnia is well-known as trouble in sleeping and enormously influences human life due to the shortage of sleep. Reactive Oxygen Species (ROS) accrue in neurons during the waking state, and sleep has a defensive role against oxidative damage and dissipates ROS in the brain. In contrast, insomnia is the source of inequity between ROS generation and removal by an endogenous antioxidant defense system. The relationship between insomnia, depression, and anxiety disorders damages the cardiovascular systems' immune mechanisms and functions. Traditionally, polysomnography is used in the diagnosis of insomnia. This technique is complex, with a long time overhead. In this work, we have proposed a novel machine learning-based automatic detection system using the R-R intervals extracted from a single-lead electrocardiograph (ECG). Additionally, we aimed to explore the role of oxidative stress and inflammation in sleeping disorders and cardiovascular diseases, antioxidants’ effects, and the psychopharmacological effect of herbal medicine. This work has been carried out in steps, which include collecting the ECG signal for normal and insomnia subjects, analyzing the signal, and finally, automatic classification. We used two approaches, including subjects (normal and insomnia), two sleep stages, i.e., wake and rapid eye movement, and three Machine Learning (ML)-based classifiers to complete the classification. A total number of 3000 ECG segments were collected from 18 subjects. Furthermore, using the theranostics approach, the role of mitochondrial dysfunction causing oxidative stress and inflammatory response in insomnia and cardiovascular diseases was explored. The data from various databases on the mechanism of action of different herbal medicines in insomnia and cardiovascular diseases with antioxidant and antidepressant activities were also retrieved. Random Forest (RF) classifier has shown the highest accuracy (subjects: 87.10% and sleep stage: 88.30%) compared to the Decision Tree (DT) and Support Vector Machine (SVM). The results revealed that the suggested method could perform well in classifying the subjects and sleep stages. Additionally, a random forest machine learning-based classifier could be helpful in the clinical discovery of sleep complications, including insomnia. The evidence retrieved from the databases showed that herbal medicine contains numerous phytochemical bioactives and has multimodal cellular mechanisms of action, viz., antioxidant, anti-inflammatory, vasorelaxant, detoxifier, antidepressant, anxiolytic, and cell-rejuvenator properties. Other herbal medicines have a GABA-A receptor agonist effect. Hence, we recommend that the theranostics approach has potential and can be adopted for future research to improve the quality of life of humans.