Overeating is driven by both the hedonic component (‘liking’) of food, and the motivation (‘wanting’) to eat it. The nucleus accumbens (NAc) is a key brain center implicated in these processes, but how distinct NAc cell populations encode ‘liking’ and ‘wanting’ to shape overconsumption remains unclear. Here, we probed the roles of NAc D1 and D2 cells in these processes using cell-specific recording and optogenetic manipulation in diverse behavioral paradigms that disentangle reward traits of ‘liking’ and ‘wanting’ related to food choice and overeating in healthy mice. Medial NAc shell D2 cells encoded experience-dependent development of ‘liking’, while D1 cells encoded innate ‘liking’ during the first food taste. Optogenetic control confirmed causal links of D1 and D2 cells to these aspects of ‘liking’. In relation to ‘wanting’, D1 and D2 cells encoded and promoted distinct aspects of food approach: D1 cells interpreted food cues while D2 cells also sustained food-visit-length that facilitates consumption. Finally, at the level of food choice, D1, but not D2, cell activity was sufficient to switch food preference, programming subsequent long-lasting overconsumption. By revealing complementary roles of D1 and D2 cells in consumption, these findings assign neural bases to ‘liking’ and ‘wanting’ in a unifying framework of D1 and D2 cell activity.