The oriental fruit fly, Bactrocera dorsalis (Hendel) (Diptera: Tephritidae), is a notable agricultural pest that undergoes pupation in the soil. Mortality risk from predation and parasitism decreases as the depth of the pupal location increases from the ground surface, with a one-centimetre increase in depth causing a significant change. Soil properties, such as moisture and hardness, influence pupation depth, but the effect of temperature has not been fully tested. This laboratory study examined whether a biologically important variation in pupation depth (e.g., one centimetre) is caused by naturally experienced temperature variations (20 to 35 °C) in B. dorsalis. The temperature–pupation depth relationship revealed a unimodal pattern, with the deepest pupation occurring at intermediate temperature levels and shallower pupation at the two extreme temperature ranges. Strong quantitative effects were observed, with the highest mean pupation depth of 40.8 mm at 27.5 °C and the lowest mean pupation depth of 15 mm at 35 °C. The observed quantitative effect suggests that temperature can strongly affect pupal mortality from predators and parasitoids by influencing pupation depth. Future studies that reveal the ability of biological control agents to forage underground for pupae at different temperatures are awaited, as this is key information for evaluating the effectiveness of these agents.