Western Digital Corp. (NASDAQ: WDC) agreed to buy SanDisk Corp. (NASDAQ: SNDK) for about $19 billion, gaining access to a supply of semiconductors that are at the heart of a fast-growing type of computer storage.

The drive maker will pay $86.50 a share for SanDisk, including $85.10 a share in cash and 0.0176 of a Western Digital common share, according to a statement Wednesday. SanDisk closed at $75.19 Tuesday in New York, giving the company a market value of $15.4 billion.

SanDisk is one of the largest makers of Nand flash memory chips, which store data in mobile devices and are increasingly being used in hard drives in computing. The technology uses less power and is faster to access information, making it more useful in cloud-computing data centers.

Western Digital is trying to branch out as its home market shrinks. The company, which had a leading 44 percent slice of the market for hard disk drives in 2014, suffered a sales decline of 4 percent in its most recent financial year as the overall business shrank to $32.9 billion, according to numbers from IDC Corp. The market for Nand flash chips, where SanDisk in combination with joint venture partner Toshiba Corp. was the largest producer, rose to $28.9 billion in 2014.

Western Digital may be using part of the proceeds from Tsinghua University’s agreement to invest $3.8 billion in the company, announced in September. The move by the Chinese state- run government entity was a further demonstration of that country’s determination to acquire U.S. technology to help it replace component imports.

That drive has helped fuel a record year for semiconductor mergers and acquisitions as companies get together to acquire scale in a slowing market where costs continue to go up.

SanDisk held talks with both Western Digital and Micron Technology Inc. about a deal, people familiar with the matter said last week.