Biogas heating plays a crucial role in the transition to clean energy and the mitigation of agricultural pollution. To address the issue of low biogas production during winter, the implementation of a multi-energy complementary system has become essential for ensuring heating stability. To guarantee the economy, stability, and energy-saving operation of the heating system, this study proposes coupling biogas and solar energy with a phase-change energy-storage heating system. The mathematical model of the heating system was developed, taking an office building in Xilin Hot, Inner Mongolia (43.96000° N, 116.03000° E) as a case study. Additionally, the Sparrow Search Algorithm (SSA) was employed to determine equipment selection and optimize the dynamic operation strategy, considering the minimum cost and the balance between the supply and demand of the building load. The operating economy was evaluated using metrics such as payback period, load ratio, and daily rate of return. The results demonstrate that the multi-energy complementary heating system, with a balanced supply and demand, yields significant economic benefits compared to the central heating system, with a payback period of 4.15 years and a daily return rate of 32.97% under the most unfavorable working conditions. Moreover, the development of a daily optimization strategy holds practical engineering significance, and the optimal scheduling of the multi-energy complementary system, with a balance of supply and demand, is realized.