We observed the diet and activity of Bornean orangutans (Pongo pygmaeus morio) in the primary lowland dipterocarp forests of Danum Valley, Sabah, Malaysia, during 2005–2007, including two mast fruitings. We collected 1,785 hr of focal data on 26 orangutans. We identified 1,466 samples of their food plants and conducted a fallen fruit census to monitor fruit availability in the study area. Their activity budget was 47.2% feeding, 34.4% resting, and 16.9% traveling. Fruits accounted for the largest part (60.9%) of feeding time, especially during mast fruiting periods (64.0–100%), although the percentages of leaves (22.2%) and bark (12.3%) were higher than those reported for P. abelii and P. pygmaeus wurmbii. Although 119 genera and 160 plant species were consumed by focal animals, only 9 genera accounted for more than 3% of feeding time (total: 67.8% for 9 genera). In particular, the focal orangutans fed intensively on Ficus and Spatholobus during most of the study period, especially in periods of fruit shortage. The percentage of fruit feeding changed markedly from 11.7 to 100% across different months of the year, and was positively correlated with the amount of fallen fruit. When fruit feeding and availability decreased, orangutans fed primarily on leaves of Spatholobus and Ficus, and the bark of Spatholobus and dipterocarp. The percentage of time devoted to feeding during mast fruitings, when the orangutans foraged almost exclusively on fruits, was lower than during seasons when the orangutan diet included leaves and bark as well as fruits. Resting increased as feeding decreased in the late stage of each fruiting season, suggesting that the orangutans adopted an energy-minimizing strategy to survive the periods of fruit shortage by using energy stored during the fruit season. Am. J. Primatol. 72:820–840, 2010. © 2010 Wiley-Liss, Inc.