Life expectancy prediction helps in enhancing healthcare services for individuals. The complexity of the factors affecting the prediction process, such as lifestyle, smoking, and exercise, makes the prediction results less reliable. Optimizing machine learning tasks using metaheuristic algorithms is very common for several applications. They can be used for parameter tuning of a certain algorithm or feature selection of the dataset. In this study, the life expectancy dataset is experimented with by applying three metaheuristic optimization approaches: the k-nearest neighbor regression algorithm parameter tuning, the feature selection, and a hybrid approach of parameter tuning and feature selection. The results show that the hybrid approach generated the best results with the advancement of 81% and 7.02 for the R-Squared (R 2 ) and the Root Mean Square Error (RMSE), respectively, compared to the K-Nearest Neighbors Regression (KNNR) without any optimization. The best results are obtained by the Grey Wolf Optimizer (GWO) algorithm with an n-neighbors value of 2, a uniform value for the weights parameter, and the Manhattan for the metric parameter. The Schooling, under-five deaths, and Year features are observed to be the most selected features by the metaheuristic algorithm.