The oviposition behavior of mosquitoes is mediated by chemical cues. In the malaria mosquito Anopheles gambiae, conspecific larvae produce infochemicals that affect this behavior. Emanations from first instar larvae proved strongly attractive to gravid females, while those from fourth instars caused oviposition deterrence, suggesting that larval developmental stage affected the oviposition choice of the female mosquito. We examined the nature of these chemicals by headspace collection of emanations of water in which larvae of different stages were developing. Four chemicals with putative effects on oviposition behavior were identified: dimethyldisulfide (DMDS) and dimethyltrisulfide (DMTS) were identified in emanations from water containing fourth instars; nonane and 2,4-pentanedione (2,4-PD) were identified in emanations from water containing both first and fourth instars. Dual-choice oviposition studies with these compounds were done in the laboratory and in semi-field experiments in Tanzania. In the laboratory, DMDS and DMTS were associated with oviposition-deterrent effects, while results with nonane and 2,4-PD were inconclusive. In further studies DMDS and DMTS evoked egg retention, while with nonane and 2,4-PD 88% and 100% of female mosquitoes, respectively, laid eggs. In dual-choice semi-field trials DMDS and DMTS caused oviposition deterrence, while nonane and 2,4-PD evoked attraction, inducing females to lay more eggs in bowls containing these compounds compared to the controls. We conclude that oviposition of An. gambiae is mediated by these four infochemicals associated with conspecific larvae, eliciting either attraction or deterrence. High levels of egg retention occurred when females were exposed to chemicals associated with fourth instar larvae.