GloucesterCancer focused Biotechnology Company Gloucester Pharmaceuticals Inc. has agreed to be acquired by New Jersey firm Celgene Corp. for approximately $640 million, with $340 million paid in cash up front.

The deal calls for Cambridge-based Gloucester Pharma to also receive $300 million in milestone payments based on meeting certain U.S. and international regulatory goals, according to officials. The companies say the deal should close within the first quarter of 2010.

Gloucester PharmaGloucester Pharma last month won approval from the U.S. Food and Drug Administration for its drug Istodax, for the treatment of cutaneous T-cell lymphoma, a type of non-Hodgkin’s lymphoma in patients who have received at least one prior systemic therapy. That marked Gloucester Pharma’s first FDA approval.

The company has taken at least $101 million in funding, according to a spokesperson, from venture capital firms Apple Tree Partners, based in Cambridge and New York City; Princeton, N.J.-based ProQuest Investments; Palo Alto, Calif.-based Prospect Venture Partners; Denmark-based Novo Ventures; and New York-based Rho Ventures. Gloucester Pharma’s latest round, a Series D round worth $29 million, was just in August.

In addition, documents with the U.S. Securities and Exchange Commission show that Gloucester Pharma has raised approximately $24 million through the placement of notes and warrants.

Founded in 2003, Gloucester Pharma licensed from Fujisawa Pharmaceutical Co. Ltd. an exclusive worldwide license to develop and commercialize Fujisawa’s novel histone deacetylase inhibitor (HDAC), known as FK228, as an anti-cancer agent.