Caloric restriction (CR) has been widely accepted as a mechanism explaining increased lifespan (LS) in organisms subjected to dietary restriction (DR), but recent studies investigating the role of nutrients have challenged the role of CR in extending longevity. Fuelling this debate is the difficulty in experimentally disentangling CR and nutrient effects due to compensatory feeding (CF) behaviour. We quantified CF by measuring the volume of solution imbibed and determined how calories and nutrients influenced LS and fecundity in unmated females of the Queensland fruit fly, Bactocera tryoni (Diptera: Tephritidae). We restricted flies to one of 28 diets varying in carbohydrate:protein (C:P) ratios and concentrations. On imbalanced diets, flies overcame dietary dilutions, consuming similar caloric intakes for most dilutions. The response surface for LS revealed that increasing C:P ratio while keeping calories constant extended LS, with the maximum LS along C:P ratio of 21:1. In general, LS was reduced as caloric intake decreased. Lifetime egg production was maximized at a C:P ratio of 3:1. When given a choice of separate sucrose and yeast solutions, each at one of five concentrations (yielding 25 choice treatments), flies regulated their nutrient intake to match C:P ratio of 3:1. Our results (i) demonstrate that CF can overcome dietary dilutions; (ii) reveal difficulties with methods presenting fixed amounts of liquid diet; (iii) illustrate the need to measure intake to account for CF in DR studies and (iv) highlight nutrients rather than CR as a dominant influence on LS.