BP said it had agreed to sell a portfolio of oil and gas assets in Pakistan to Hong Kong-listed United Energy Group <0467.HK> for $775 million as it raises cash to pay for the Gulf of Mexico oil spill.

BP said on Tuesday that the planned disposal of its upstream assets in Pakistan brought to $21.8 billion the amount that the company has raised, or agreed sales on, in recent months.

The $775 million value of the disposal was higher than the $690 million analysts estimated the assets were worth in July.

BP said it expects the costs of the Gulf oil spill -- the United States worst ever -- to hit $40 billion and said it would sell assets worth $25-$30 billion by the end of 2011 to pay for it.

Most recently it raised $7 billion through the sale of its stake in Argentina-based Pan American Energy

to China's CNOOC <0883.HK>.

United Energy Group, which has oil and gas interests in China and Indonesia and also operates in the oilfield services sector, beat off competition from Pakistan's Oil and Gas Development Co (OGDCL) which said earlier in December it was bidding for the assets alongside partner Pakistan Petroleum

.

The cash sale included nine producing and exploration blocks and four offshore exploration blocks, said the company, but excluded four of BP's unexplored, non-operated blocks which it said it was reviewing with its partners, one of which is OGDCL.

BP said the deal was subject to regulatory approval and it expected it to complete in the first half of next year.

Shares in BP gained 1.4 percent to 464.55 pence at 1102 GMT outperforming the European index of oil and gas companies <.SXEP> which was up 0.2 percent.

(Reporting by Sarah Young; Editing by Matt Scuffham)