Chemical dyes present in wastewater generated from textile and paint industries can cause serious environmental and health hazards if not adequately treated. Photocatalytic degradation, an eco-friendly water treatment method, utilizes charge carriers generated from sunlight to remove pollutants in water without requiring additional energy input. Since the interaction between polluted water and a catalyst is crucial in water treatment, an emerging technology involves the combination of porous materials and light-sensitive materials. In this study, BaTiO3 nanoparticles are loaded into a Zeolitic Imidazolate Framework (ZIF-8) to create BaTiO3 @ZIF-8 nanocomposites for the photocatalytic degradation of methylene blue (MB) under solar irradiation. To facilitate the smooth transfer of charge carriers between BaTiO3 and ZIF-8, ZIF-8 has been synthesized in the presence of BaTiO3, allowing ZIF-8 to grow on the surface of BaTiO3. The concentration of BaTiO3 is adjusted during synthesis to optimize the photocatalytic performance. Among the different compositions, 25 wt% BaTiO3 @ZIF-8 demonstrates the highest photocatalytic activity. This composite efficiently degrades 93 % of MB dye in 180 min and completely degrades the Congo Red dye in just 75 min under solar irradiation. Furthermore, the photocatalyst exhibits good cyclability over four cycles, maintaining its excellent performance. These results suggest that the current study contributes to the synthesis of highly effective photocatalysts for the breakdown of dyes in aqueous media under sunlight exposure.