The IoT has applications in many areas such as manufacturing, healthcare, and agriculture are a few to name. Recently, wearable devices have become increasingly popular with wide applications in the health monitoring system that encourages the growth of the Internet of medical things (IoMT). The IoMT has an important role to play to reduce the mortality rate by early detection of disease. Prediction of heart disease is a key issue in the analysis of clinical data. The aim of the proposed research is to identify the key characteristics of heart disease prediction using machine learning techniques. Many studies have focused on heart disease diagnosis, but the accuracy of the findings is low. Therefore, to improve the prediction accuracy an IoMT framework for the diagnosis of heart disease using modified salp swarm optimization (MSSO) and adaptive neuro-fuzzy inference system (ANFIS) is proposed. The proposed MSSO-ANFIS improves search capability using the Levy flight algorithm. The regular learning process in ANFIS is dependent on gradient-based learning that is likely to trap into local minima. The learning parameters are optimized utilizing MSSO for providing a better result of ANFIS. The following characteristics are taken from medical records to predict the risks of heart disease in a patient such as blood pressure (BP), age, sex, chest pain, cholesterol, blood sugar, etc. The heart condition is identified by classifying the received sensor data using MSSO-ANFIS. The framework presents simulation and analysis to show that it works well for disease prediction. The results of the simulation demonstrate that the MSSO-ANFIS prediction model achieves better accuracy than other approaches. The proposed MSSO-ANFIS prediction model has obtained an accuracy of 99.45 with a precision of 96.54, which is higher than other approaches.