We consider the coupled problems of optimal thermostat programming and optimal pricing of electricity. Our framework consists of a single user and a single provider (a regulated utility). The provider sets prices for the user, who pays for both total energy consumed ($/kWh, including peak and off-peak rates) and the peak rate of consumption in a month (a demand charge) ($/kW). The cost of electricity for the provider is based on a combination of capacity costs ($/kW) and fuel costs ($/kWh). In the optimal thermostat programming problem, the user minimizes the amount paid for electricity while staying within a pre-defined temperature range. The user has access to energy storage in the form of thermal capacitance of the interior structure of the building. The provider sets prices designed to minimize the total cost of producing electricity while meeting the needs of the user. To solve the user-problem, we use a variant of dynamic programming. To solve the provider-problem, we use a descent algorithm coupled with our dynamic programming code - yielding optimal on-peak, off-peak and demand prices. We show that thermal storage and optimal thermostat programming can reduce electricity bills using current utility prices from utilities Arizona Public Service (APS) and Salt River Project (SRP). Moreover, we obtain optimal utility prices which lead to significant reductions in the cost of generating electricity and electricity bills.