By Jonathan D. Rockoff

Illumina Inc., a leading maker of the machines that sequence genes, will pay $7.1 billion in cash and stock for a developer of a long-sought blood test that promises to detect cancer early, people familiar with the matter said.

The deal for the part of Grail Inc. that Illumina doesn't already own is expected to be announced Monday. It will move Illumina deeper into the application of its gene-sequencing technology to the diagnosis and treatment of patients, a potential multibillion-dollar market.

Illumina founded Grail four years ago and owns a large stake in the company. Under the terms of the agreement, Grail owners excluding Illumina will get $3.1 billion in cash and shares in the gene-sequencer maker worth the remaining $4 billion, the people said.

The owners will also have the option to receive additional cash or stock, or get contingent value rights to a portion of Grail's annual revenue for the next 12 years, the people said.

Last week Bloomberg reported Illumina was nearing a deal for Grail. The agreement comes as Grail was laying the groundwork to go public.

The purchase will be Illumina's biggest acquisition, and propel it further into the clinical applications of its gene sequencers and related products and services, which have rung up $1.3 billion of the company's $1.5 billion in total revenue during the first half of this year.

Over the past several years San Diego-based Illumina has been seeking a larger position in the faster-growing genomic-application market.

To get that, Illumina is paying up for a company that doesn't have any revenue. The deal's success will depend on Illumina successfully launching Grail's cancer-detection blood test and persuading health insurers to pay for it.

Illumina has a small genomic-application business, selling molecular tests that help doctors diagnose genetic diseases and pick cancer therapies. In 2013, Illumina bought the company Verinata Health and its test that looks in the blood of pregnant women for fetal chromosomal disorders like Down syndrome.

Grail grew out of Illumina's discovery of signs of cancers in the maternal blood samples.

Ever since, the Menlo Park, Calif., firm has been on the front lines of efforts by a number of companies seeking to build a blood test that detects tumors in patients even before they show symptoms. Such tests are often referred to as "liquid biopsies."

Identifying cancer so quickly has been a long-sought but elusive goal of doctors and researchers, because it promises the opportunity for earlier and more effective treatment.

The research has proven challenging. The tests need to look for a range of molecular cancer markers if they were going to identify a variety of different tumors. To avoid false positives, the tests also need to distinguish between mutated DNA shed by tumors and by other cells.

Grail has been planning to launch its test, called Galleri, next year. Studies found it could detect more than 50 different cancers, and it generated false positives less than 1% of the time, according to the company. Studies also found the test often identified the cancer type.

The test is expected to appeal to patients and doctors, but analysts have said its commercial potential will depend on gaining reimbursement. Grail has been planning to target the test initially for sale to buyers such as concierge-medicine practices and self-insured employers.

Write to Jonathan D. Rockoff at Jonathan.Rockoff@wsj.com