Sun bear (Helarctos malayanus) frugivory and fruiting phenology was investigated in a lowland dipterocarp forest in East Kalimantan, Indonesia. Two mast fruiting events, both coinciding with El Niño/Southern Oscillation events, occurred 4 years apart, resulting in large fluctuations in fruit availability. Sun bear fruit availability decreased from 13 trees ha−1 fruiting month−1 during the mast fruiting to 1.6 trees ha−1 fruiting month−1 during the intermast period. Almost 100% of sun bear diet consisted of fruit during mast fruiting period, whereas sun bear diet was predominantly insectivorous during intermast periods. The majority of sun bear fruit trees displayed ‘mast-fruiting’ and ‘supra-annual’ fruiting patterns, indicating sporadic productivity. Sun bears fed on 115 fruit species covering 54 genera and 30 families, with Ficus (Moraceae) being the main fallback fruit. The families Moraceae, Burseraceae, and Myrtaceae contributed more than 50% to the sun bear fruit diet. Sun bear fruit feeding observations were unevenly distributed over forest types with more observations in high-dry forest type despite fewer fruiting events, possibly due to a side-effect of high insect abundance that causes bears to use these areas more intensively. The possible evolutionary pathways of sun bears in relation to the Sundaic environment are discussed. © 2006 The Linnean Society of London, Biological Journal of the Linnean Society, 2006, 89, 489–508.