Pharmacy giant Walgreens Boots Alliance said on Tuesday that it will buy rival Rite Aid that would further expand the company’s role in the distribution of medications in the U.S.

The corporate parent of Walgreens, Walgreens Boots Alliance valued the deal at $17.2 billion including debt. The company said in a statement that Rite Aid will continue to operate under its existing name.

The deal would combine the second- and third-largest drugstore chains in the U.S., with a total of about 12,800 locations, helping Walgreens move past market leader CVS Health Corp. The combined companies could achieve more than $1 billion in cost savings, the companies said in a statement. Walgreens said that it expects the transaction to close in the second half of 2016.

The deal comes amid a broader shake-up in the corporate setup of the healthcare industry, which earlier in the year saw consolidation among major insurance providers when Anthem purchased Cigna and Aetna acquired Humana.

Deerfield, Ill., based Walgreens Boots Alliance has more than 8,000 stores in the United States and generated about $73 billion in sales last year. Rite Aid has just over half as many locations and saw $27 billion in sales in 2014.

Walgreens chief executive Stefano Pessina said in a statement that the deal will further boost the company’s commitment to make quality health care accessible to more customers and patients.

The deal could come under scrutiny of the antitrust regulators as both retailers are large players in the pharmacy category. Besides, the two retailers are no strangers to mergers. Camp Hill, Pa., based Rite Aid acquired Envision Rx, a pharmacy-benefits manager, for about $2 billion in June. Earlier in 2006, the company purchased two of its smaller drugstore rivals, Eckerd and Brooks.

In December last year, the company then known as Walgreen consolidated with Alliance Boots, a privately-held pharmacy and beauty company that has a large presence in Europe. The new company, named Walgreens Boots Alliance, has been working to cut down costs, including with a plan announced earlier this year to close 200 stores in the United States.

Along with their biggest competitor, CVS, Rite Aid and Walgreens have been looking to expand the role they play in delivering healthcare services to consumers, including in-store clinics.

Walgreens Boots is expected to release its latest quarterly earnings on Wednesday morning before the stock market opens.