This study aims to define a cost-optimal solution based on demand response (DR) actions for a thermal energy storage system with a ground source heat pump in detached residential houses in a cold climate. This study finds out the minimum life cycle cost (LCC) of thermal energy storage over the period of 20 years by observing different temperature set points (55-95 °C) and sizes (0.3-1.5 m3) of a hot water storage tank with developed DR control algorithms. Three different control algorithms were studied: (A) a momentary DR control algorithm based on real-time hourly electricity price (HEP), (B) a backwards-looking DR control algorithm based on previous HEPs and (C) a predictive DR control algorithm based on future HEPs. This research was carried out with the validated dynamic building simulation tool IDA Indoor Climate and Energy. The results show that by using the predictive DR control algorithm the maximum annual savings in total delivered energy and cost are about 12% and 10%, respectively. The minimum LCC can be achieved by the smallest studied storage tank size of 0.3 m3 with 60 °C as the temperature set point, but the effect of storage tank size on LCC is relatively small.