The process of thermal control and regulation in buildings is considered complex. Its complexity lies in the various internal and external physical phenomena impacting its control, and also in the increasingly important requirements of occupant comfort, energy optimization and efficiency, and optimization of measuring and monitoring equipment. Recently, the establishment of technical rules for optimal building thermal control has gained interest in academia and industry. These rules have focused mainly on three aspects: the use of renewable energy, optimal management, and the use of equipment and materials allowing the optimization of energy. However, optimal control has not been addressed enough. In this article, we present a PID controller based on a Neural Network approach for thermal building management and control. The proposed approach is based on two processes: an optimal identification process dedicated to the thermal building behavior prediction impacted by variable and invariable elements, measured and unmeasured factors, and a control process to ensure the desired performance with optimal energy control. The results obtained show the advantages of the adopted system in terms of energy optimization, with an important energy gain of 8% to 11%, along with better regulation and control performance, and in terms of occupant comfort with minimal temperature variations.