The scientist hunched over beakers, conducting drug research by hand, may soon be a memory.

Companies like Eli Lilly & Co. and GlaxoSmithKline PLC are investing in automation with the hope of transforming drug discovery from an enterprise where humans do manual experiments to one where robots handle thousands of samples around the clock. This automation will be key to developing better therapies more efficiently, drug companies say, as research and development becomes more labor intensive amid the push toward more-tailored...