NEW YORK (AP) — BioSante Pharmaceuticals (ANIP -1.37%) said Thursday it will merge with ANI Pharmaceuticals in an all-stock deal worth about $94 million.

BioSante has spent years developing LibiGel, a testosterone gel intended to treat sexual dysfunction in women, but has not been able to gain approval because of study failures and safety concerns. ANI markets branded and generic drugs and provides contract drug manufacturing services, and it had about $16 million in revenue in 2011. The companies said the deal combines BioSante's cash and expected revenue from licensing deals with ANI's current revenue.

BioSante valued the deal at $93 million to $95 million based on its current share price, according to a company spokesman. In midday trading its shares lost 19 cents to $1.61.

The boards of both companies have approved the deal and said it should close in the first quarter of 2013. The combined company will take BioSante's corporate structure but will change its name to ANI Pharmaceuticals. Current ANI shareholders will own 53 percent of the new company, and Arthur Przybyl of ANI will be its president and CEO. The board will include four other ANI directors and two BioSante directors.

BioSante, based in Lincolnshire, Ill., reported about $223,000 in revenue in the first half of 2012, and the company said ANI's revenue will help support development of more costly products. That includes several experimental cancer treatments as well as LibiGel.

Shares of BioSante have fallen 88 percent since mid-December, when the company said LibiGel failed in two late-stage clinical trials. In September the company reported positive data from safety studies, saying clinical testing did not reveal links between LibiGel and heart attack or breast cancer. BioSante plans to ask the FDA to approve two new late-stage trials of LibiGel in early 2013.

ANI is based in Baudette, Minn., and its approved products include generic versions of the obsessive compulsive disorder treatment Luvox, the hormone replacement drug Estratest, and Reglan, a drug used to treat slow stomach emptying in diabetes patients.

BioSante helped develop the hot flash treatment Elestrin, which is marketing by Jazz Pharmaceuticals PLC. Early this year, the Food and Drug Administration approved a testosterone gel that BioSante developed. Bio-T-Gel will be marketed by Teva Pharmaceutical Industries Ltd. However, no launch date for the product has been announced.

BioSante said it will distribute contingent value rights worth up to $40 million to its shareholders before the deal closes. Those rights mean shareholders will receive payments from future sales, licenses, or other deals involving LibiGel.