The health insurance giant Cigna said on Thursday that it had agreed to buy Express Scripts, the nation’s largest pharmacy benefit manager, in a $52 billion deal that could further reshape the roiling health care landscape.

The deal is the latest in a wave of consolidations that is sweeping through the health care industry. Companies are reacting to concerns over rising health care costs and the possibility of powerful new rivals entering the fray. In particular, Amazon’s move into the health care business has forced established companies to rethink how they can compete.

Cigna and Express Scripts said the acquisition would benefit consumers by allowing the two companies to bring together patients’ medical and pharmacy histories to improve treatments and lower costs.

“This step furthers our strategy to improve the affordability and value to the consumer in a more personalized way,” said Cigna’s chief executive, David Cordani, who will serve as chief executive for the combined company.