Teva Pharmaceutical Industries Ltd. is in advanced talks to buy Allergan PLC’s generic-drug business in the midst of a thus-far-unsuccessful effort to acquire peer Mylan NV, according to a person familiar with the matter. Jerusalem-based Teva, which has offered to buy Mylan for $40 billion, is now close to an agreement to acquire Dublin-based Allergan’s generic-drugs unit for between $40 billion and $45 billion, the person said.

A deal could be announced as early as next week, the person said, cautioning that negotiations had not yet been completed and requesting not to be identified because the discussions are confidential. Teva and Allergan representatives did not respond to requests for comment.

Large drugmakers are attempting to realign their operations to focus on a small number of leading businesses, while smaller specialty and generic producers are seeking larger scale. Allergan’s branded-drugs business makes products such as Botox and the Alzheimer’s drug Namenda. Its generics business provides about one-third of the company’s total revenue.

A successful deal with Allergan would give Teva, which has a market capitalization of $60 billion, a much bigger footprint in the generic-drugs sector. It would also offer opportunities for significant cost synergies and tax savings.

Last year, Actavis PLC outbid Canadian drugmaker Valeant Pharmaceuticals International Inc. and activist investor William Ackman to merge with Allergan and adopt its name. Allergan now has a market capitalization of $121 billion.

Teva’s bid for Mylan took a hit last week when the latter’s independent Dutch foundation exercised a call option allowing it to buy 50 percent of Mylan’s total issued and outstanding capital, giving it temporary control of one-half the company. Known as Stichting, the foundation opposes Teva’s bid, arguing that a Teva takeover would likely lead to job losses at Mylan and reduce access to cheap generic medicines in emerging markets.

For its part, Mylan is pressing on with a $34 billion hostile bid for Perrigo Co. PLC. Were Teva to clinch a deal with Allergan for its generic-drug business and drop its bid for Mylan, this would likely strengthen the hand of Mylan’s management in its campaign to buy Perrigo.

The Wall Street Journal first reported that Teva was in advanced talks to acquire Allergan’s generic-drug unit.

(Reporting by Greg Roumeliotis in New York; Editing by Steve Orlofsky)