This paper develops a new method for estimating a demand function and the welfare consequences of price changes. The method is applied to gasoline demand in the U.S. and is applicable to other goods. The method uses shape restrictions derived from economic theory to improve the precision of a nonparametric estimate of the demand function. Using data from the U.S. National Household Travel Survey, we show that the restrictions are consistent with the data on gasoline demand and remove the anomalous behavior of a standard nonparametric estimator. Our approach provides new insights about the price responsiveness of gasoline demand and the way responses vary across the income distribution. We find that price responses vary nonmonotonically with income. In particular, we find that low- and high-income consumers are less responsive to changes in gasoline prices than are middle-income consumers. We find similar results using comparable data from Canada.