A breathable gas supply system comprises a flow sensor, a control unit and a storage unit. The flow sensor detects a gas state of a flow channel. The control unit provides an initial template value and continuously receives sampled breath values from the flow sensor to repetitively perform a first breath sampling process so as to generate a first template value for replacing the initial template value; then the control unit continuously receives sampled breath values from the flow sensor to repetitively perform a second breath sampling process so as to generate a second template value; finally the control unit integrates the first template value and the second template value to obtain an updated template value for replacing the first template value, and the aforesaid operations are repeated to generate a new second template value to obtain a new updated template value. The storage unit stores the first template value, each second template value and each updated template value. A method of controlling the breathable gas supply system and a computer program product implementing the method are also provided.