The recent rise of renewable energy technologies in the building sector is expected to reduce fossil fuel consumption but leads to a greater complexity in the design and control of Heating, Ventilation, and Air Conditioning (HVAC) systems. As a consequence, the traditional control approach does not fully exploit the potential of the photovoltaic-assisted hybrid HVACs. This paper presents an investigation on the energy cost savings and the optimal control strategies of a photovoltaic-assisted hybrid heating system based on optimal control theory. The considered system consists of a radiant floor heating system, a gas boiler and a photovoltaic-assisted air-source heat pump (AS-HP) as heat sources, with a water tank as thermal energy storage (TES). The building thermal dynamics and all the components of the heating system were modelled in MATLAB environment together with a baseline rule-based controller (RBC). The optimal control problem is formulated such that cost function, constraints, state and control variables are defined. Due to a large number of states and control variables, the optimal control problem is converted to the nonlinear parameter optimization problem, and the solution is obtained by using nonlinear programming (NLP). For simulation settings, model parameters, weather, and energy demand profiles were adopted from historical data from a North Italian case study. The simulation results show that the photovoltaic-assisted hybrid heating system coupled with optimal energy management strategy can potentially save up to 20% of the energy consumption cost when compared to the state-of-art RBC and increase the photovoltaic self-consumption by 30%.