The benchmark September contract for cocoa in London gained more than 2% on Wednesday to 2,590 pounds per metric ton. The session high was the highest price since 1977 at 2,594 pounds.

Prices are rising in reaction to a tight market for cocoa beans, which are mainly produced in Ivory Coast and Ghana. Arrivals of cocoa at Ivory Coast ports for export are down nearly 5% this season.

The International Cocoa Organization (ICCO) widened this month its forecast for a global deficit on cocoa supply from 60,000 metric tons previously to 142,000 metric tons.

"It is the second consecutive season with a supply deficit," said Leonardo Rosseti, cocoa analyst at broker StoneX.

He said that the stocks-to-use ratio, an indicator of cocoa availability in the market, is expected to fall to 32.2%, the lowest since the 1984/85 season.

Meanwhile, above-average rains in Ivory Coast are causing flooding in some cocoa fields, potentially hurting the main crop that starts in October.

Rosseti said that the rains are also hurting the drying process for cocoa beans that have already been collected.

Refinitiv Commodities Research said it expects moderate to high rainfall in the West African cocoa belt over the next 10 days.

Cocoa prices rose in New York as well. The September contract gained 2.7% to $3,348 a metric ton, its highest in 7-1/2 years.

In other soft commodities, July raw sugar fell 0.46 cent, or 2%, at 22.57 cents per lb. Arabica coffee settled down 5 cents, or 3%, at $1.6195 per lb, while robusta coffee fell $99, or 3.6%, at $2,616 a metric ton.

(Reporting by Maytaal Angel; Editing by Mark Potter and David Gregorio)

By Maytaal Angel and Marcelo Teixeira