Males of many insects eclose with their entire lifetime sperm supply and have to allocate their ejaculates at mating prudently. In polyandrous species, ejaculates of rival males overlap, creating sperm competition. Recent models suggest that males should increase their ejaculate expenditure when experiencing a high risk of sperm competition. Ejaculate expenditure is also predicted to vary in relation to sperm competition intensity. During high intensity, where several ejaculates compete for fertilization of the female's eggs, ejaculate expenditure is expected to be reduced. This is because there are diminishing returns of providing more sperm. Additionally, sperm numbers will depend on male's ability to assess female mating status. We investigate ejaculate allocation in the polyandrous small white butterfly Pieris rapae (Lepidoptera). Males have previously been found to ejaculate more sperm on their second mating when experiencing increased risk of sperm competition. Here we show that males also adjust the number of sperm ejaculated in relation to direct sperm competition. Mated males provide more sperm to females previously mated with mated males (i.e. when competing with many sperm) than to females previously mated to virgin males (competing with few sperm). Virgin males, on the other hand, do not adjust their ejaculate in relation to female mating history, but provide heavier females with more sperm. Although virgin males induce longer non–receptive periods in females than mated males, heavier females remate sooner. Virgin males may be responding to the higher risk of sperm competition by providing more sperm to heavier females. It is clear from this study that males are sensitive to factors affecting sperm competition risk, tailoring their ejaculates as predicted by recent theoretical models.