1. The risk of parasitism and infectious disease is expected to increase with population density as a consequence of positive density-dependent transmission rates. Therefore, species that encounter large fluctuations in population density are predicted to exhibit plasticity in their immune system, such that investment in costly immune defences is adjusted to match the probability of exposure to parasites and pathogens (i.e. density-dependent prophylaxis). 2. Despite growing evidence that insects in high-density populations show the predicted increase in resistance to certain pathogens, few studies have examined the underlying alteration in immune function. As many of these species show increased cuticular melanism at high densities, the aim of this study was to use a multivariate approach to quantify relative variation in the allocation of resources to immunity associated with both rearing density (solitary vs. crowded) and cuticular colour (pale vs. dark) in a phase-polyphenic Lepidopteran species (Spodoptera littoralis Boisduval). 3. Relative to pale individuals, dark larvae (the high-density phenotype) exhibited higher haemolymph and cuticular phenoloxidase (PO) activity and a stronger melanotic encapsulation response to an artificial parasite inserted into the haemocoel. However, they also exhibited lower antibacterial (lysozyme-like) activity than pale larvae. Larval density per se had little effect on most of the immune parameters measured, though capsule melanization and antibacterial activity were significantly higher in solitary-reared than crowded larvae. 4. Correcting for variation in larval body condition, as estimated by weight and haemolymph protein levels, had little effect on these results, suggesting that variation in immune function across treatment groups cannot be explained by condition-dependence. These results are examined in relation to pathogen resistance, and the possibility of a trade-off within the immune system is discussed.