This paper presents a novel price setting optimization problem for an energy retailer in the smart grid. In this framework the retailer buys energy from multiple generators via bilateral contracts, and sells it to a population of smart homes using Time-and-Level-of-Use prices (TLOU). TLOU is an energy price structure recently introduced in the literature, where the prices vary depending on the time and the level of consumption. This problem is formulated as a bilevel optimization problem, in which the energy retailer wants to set the prices that maximize the profit, anticipating the reaction of a population that wants to minimize the total cost. We explicitly consider the users load shifting preferences, their shifting decisions, and the level of consumption in the definition of the price structure. The optimization problem is reformulated as a single-level problem to be solved by off-the-shelf solvers. Computational experiments validate the performance of TLOU and show that the retailer’s economical benefit is enhanced through the implementation of this type of demand response program, while providing savings for the consumers.