Critical to evolutionary fitness, animals regulate social behaviors by integrating signals from both their external environments and internal states. Here, we find that population density modulates the courtship behavior of male Drosophila melanogaster in an age-dependent manner. In a competitive mating assay, males reared in a social environment have a marked advantage in courting females when pitted against males reared in isolation. Group housing promotes courtship in mature (7-day) but not immature (2-day) males; this behavioral plasticity requires the Or47b pheromone receptor. Using single-sensillum recordings, we find that group housing increases the response of Or47b olfactory receptor neurons (ORNs) only in mature males. The effect of group housing on olfactory response and behavior can be mimicked by chronically exposing single-housed males to an Or47b ligand. At the molecular level, group housing elevates Ca2+ levels in Or47b ORNs, likely leading to CaMKI-mediated activation of the histone-acetyl transferase CBP. This signaling event in turn enhances the efficacy of juvenile hormone, an age-related regulator of reproductive maturation in flies. Furthermore, the male-specific Fruitless isoform (FruM) is required for the sensory plasticity, suggesting that FruM functions as a downstream genomic coincidence detector in Or47b ORNs-integrating reproductive maturity, signaled by juvenile hormone, and population density, signaled by CBP. In all, we identify a neural substrate and activity-dependent mechanism by which social context can directly influence pheromone sensitivity, thereby modulating social behavior according to animals' life-history stage.