Thermal storage plays a major role in a wide variety of industrial, commercial, and residential applications when there is a mismatch between the offer and the claim of energy. In this paper, we study numerically the contribution of phase change materials (PCMs) for solar thermal energy storage (TES) in buildings. The studied configuration is a plane solar collector incorporating a PCM layer and coupled to a concrete slab (a roof of a building). The study is conducted for Casablanca (Morocco) meteorological conditions. Several simulations were performed to optimize the melting temperature and the PCM layer thickness. The results show that PCM imposes, on the roof, a temperature close to its melting temperature. The choice of a melting temperature Tmelt = 22 °C (the local indoor temperature Tc is fixed as Tc = 22 °C) limits the losses through the concrete slab, considerably. This last seems to be, nearly, adiabatic, in this case. Also, the energy released by PCM solidification, overnight, increases the outlet temperature of the coolant fluid to 35 °C and the useful flux to 80 W/m2, increasing the efficiency of the solar collector by night. The PCM functioned both as an energy storage material for the stabilization of the coolant fluid temperature and as an insulating material for the building.