Its latest acquisition will help BASF focus on high-margin sectors such as personal care products and cosmetics as it diversifies away from core gas, oil, and plastics activities.
BASF said it had agreed on terms of a sale with the owners of Cognis, investment fund Permira and US investment bank Goldman Sachs, based on an equity purchase price of €700 million.
"Including net financial debt and pension obligations, the enterprise value of the transaction is €3.1 billion," a statement added.
BASF chairman Jürgen Hambrecht told a telephone news conference that the acquisition meant his group was "strengthening our portfolio with cyclically robust and profitable businesses and further expanding our position as the world's leading chemical company."
Cognis produces chemicals used in a broad range of products, from cosmetics to adhesives and lubricants.
It has 5,500 employees and posted sales last year of €2.6 billion.
Cognis is BASF's biggest purchase since it bought the Swiss specialty chemical group Ciba last year for €3.8 billion.
"Cognis is a nice fit for BASF," UniCredit analysts wrote in a research note.
They said Cognis was the leading producer of surfactants used in detergents, and that it "has a strong global footprint" especially in Asia.
BASF added that the deal should help it become a major supplier of products based on renewable raw materials.
The German giant wants to finalise its purchase by the end of November, and expects integration costs of €200-250 million by the end of 2012.
Overall annual savings of at least €130 million should be reached by 2013, the group added, without specifying if it planned major job cuts.
The deal should boost BASF sales, which would have reached €48.7 billion last year if Cognis' results were included.
BASF shares gained 1.26 percent to €47.33 in afternoon trading on the Frankfurt stock exchange, while the DAX index of German blue-chips was 0.20 percent lower overall.