The solar energy retention rate of a flat plate collector can be increased by increasing water flow rate through the collector which also increases the pumping energy incurred in obtaining that solar energy. The problem of optimal flow rate is formulated to fit within the framework of pontryagin's maximum principle and with a few simplifying assumptions, an optimal solution that can be easily implemented is obtaincd, The optimal solution is used in the simulation of a solar heating system using actual climatological data and the results are compared with that of on-off control. The result that not only the object function but, In some cases, also the solar energy retention rate the collector is increased. In is also found that the optimal control gets more advantageous as the solar insolation level gets lower, and also as tile cost of auxiliary heating fuel gets higher.