Healthcare occupies a central role in sustainable societies and has an undeniable impact on the well-being of individuals. However, over the years, various diseases have adversely affected the growth and sustainability of these societies. Among them, heart disease is escalating rapidly in both economically settled and undeveloped nations and leads to fatalities around the globe. To reduce the death ratio caused by this disease, there is a need for a framework to continuously monitor a patient’s heart status, essentially doing early detection and prediction of heart disease. This paper proposes a scalable Machine Learning (ML) and Internet of Things-(IoT-) based three-layer architecture to store and process a large amount of clinical data continuously, which is needed for the early detection and monitoring of heart disease. Layer 1 of the proposed framework is used to collect data from IoT wearable/implanted smart sensor nodes, which includes various physiological measures that have significant impact on the deterioration of heart status. Layer 2 stores and processes the patient data on a local web server using various ML classification algorithms. Finally, Layer 3 is used to store the critical data of patients on the cloud. The doctor and other caregivers can access the patient health conditions via an android application, provide services to the patient, and inhibit him/her from further damage. Various performance evaluation measures such as accuracy, sensitivity, specificity, F1-measure, MCC-score, and ROC curve are used to check the efficiency of our proposed IoT-based heart disease prediction framework. It is anticipated that this system will assist the healthcare sector and the doctors in diagnosing heart patients in the initial phases.