Home energy systems (HESs) face challenges, including high energy costs, peak load impact, and reliability issues associated with grid connections. To address these challenges, homeowners can implement solutions such as energy management, renewable resources, and energy storage technologies. Understanding consumption patterns and optimizing HES operations are crucial for effective energy management. As a primary step, addressing these concerns requires an efficient forecasting tool to predict home energy demand and electricity prices. Due to the complexity of big data, and uncertainties involved in forecasting, machine learning (ML) methods are necessary. In this study, we develop a hybrid machine learning approach, utilizing one year of data on home energy demand and prices to address the challenge of forecasting home energy consumption. A comprehensive comparison of different deep and non-deep ML models highlights the superiority of the proposed hybrid approach. The performance of these models, measured using metrics such as RMSE, MAE, R2, and RT (running time), are compared. Finally, an optimized hybrid XGBoost (XGB) ML model that combines price and energy demand forecasting is introduced. The proposed ML method’s parameters are optimally determined using Particle Swarm Optimization. The hybrid ML model’s performance is evaluated in predicting both energy demand and consumption prices using historical data from diverse households with various features and consumption patterns. The results indicate that the hybrid ML model achieves accurate predictions for energy consumption and prices, with improvements in RMSE (up to 36.6%), MAE (up to 36.8%), and R2 (up to 3.9), as compared to conventional ML methods. This research contributes to sustainable energy practices by providing an effective tool for forecasting energy consumption and associated costs in the dynamic landscape of home energy systems.