Knowledge of the genetic basis underlying variation in response to environmental exposures or treatments is important in many research areas. For example, knowing the set of causal genetic variants for drug responses could revolutionize personalized medicine. We used Drosophila melanogaster to investigate the genetic signature underlying behavioral variability in response to methylphenidate (MPH), a drug used in the treatment of attention-deficit/hyperactivity disorder. We exposed a wild-type D. melanogaster population to MPH and a control treatment, and observed an increase in locomotor activity in MPH-exposed individuals. Whole-genome transcriptomic analyses revealed that the behavioral response to MPH was associated with abundant gene expression alterations. To confirm these patterns in a different genetic background and to further advance knowledge on the genetic signature of drug response variability, we used a system of inbred lines, the Drosophila Genetic Reference Panel (DGRP). Based on the DGRP, we showed that the behavioral response to MPH was strongly genotype-dependent. Using an integrative genomic approach, we incorporated known gene interactions into the genomic analyses of the DGRP, and identified putative candidate genes for variability in drug response. We successfully validated 71% of the investigated candidate genes by gene expression knockdown. Furthermore, we showed that MPH has cross-generational behavioral and transcriptomic effects. Our findings establish a foundation for understanding the genetic mechanisms driving genotype-specific responses to medical treatment, and highlight the opportunities that integrative genomic approaches have in optimizing medical treatment of complex diseases.