The use of machine learning (ML) within medical field is on the rise, notably as a means to enhance both the speed and precision of diagnosis. Through evaluating large volumes of patient information, machine learning is able to provide disease prediction, giving both patients and doctors more control over their health. Predicting and preventing heart disease has become a major area of study in medical data processing as a result of the increased expense of therapy. Since there are so many factors that come into play, estimating one's heart disease risk manually is a challenging task. Moreover, there are very few methods which provide better accuracy for the prediction of the heart disease. Hence, by using openly accessible cleveland heart disease dataset, this research aims to design and evaluate several advanced technologies constructed employing machine leaning algorithms for diagnosing if an individual is going to get heart disease or not. In this paper, we propose an ensemble feature optimized (EFO) learning method which uses an enhanced extreme gradient boosting tree and feature level cross validation scheme for effective heart disease (EHD) prediction. The presented EFO prediction algorithm and other existing machine learning algorithms have been used for the prediction of the heart diseases. The performance of the existing algorithms (XGB-based, ensemble tree hyper optimization (ETHO), and MLP-PSO) and proposed EFO algorithm has been evaluated using the classification metrics. When compared with the XGB-based, ensemble tree hyper optimization (ETHO), and MLP-PSO algorithm, the EFO algorithm has attained an accuracy of 98.61%. The EFO algorithm provides the doctors to able to predict the heart disease more efficiently and effectively.