Agilent Technologies Inc. agreed to buy closely held BioTek Instruments Inc. for $1.17 billion, in a deal designed to capitalize on a push by big pharmaceutical companies to develop new drugs that harness the immune system to fight cancer.

Santa Clara, Calif.-based Agilent makes instruments and software and provides services to drugmakers in the process of developing new therapies. BioTek, based in Winooski, Vt., focuses on cell-imaging systems that allow companies to see how therapies work in real time.

“This...