* BP says deal gives it some of best onshore U.S. acreage
* Deal to boost BP earnings, cash flow per share
* BP plans $5-$6 bln share buyback, funded by divestments
* Sale price better than expected, investor, analysts say
* BHP says to return sale funds to shareholders (Adds graphic, analyst comments)
By Sonali Paul and Ron Bousso
MELBOURNE/LONDON, July 27 (Reuters) - BP Plc has agreed to buy U.S. shale oil and gas assets from global miner BHP Billiton for $10.5 billion, expanding the British oil major's footprint in some of the nation's most productive oil basins in its biggest deal in nearly 20 years.
The acquisition of about 500,000 producing acres marks a turning point for BP since the Deepwater Horizon rig disaster in the Gulf of Mexico in 2010, for which the company is still paying off more than $65 billion in penalties and clean-up costs.
"This is a transformational acquisition for our (onshore U.S.) business, a major step in delivering our upstream strategy and a world-class addition to BP's distinctive portfolio," BP Chief Executive Bob Dudley said in a statement.
In a further sign of the upturn in its fortunes, BP said it would increase its quarterly dividend for the first time in nearly four years and announced a $6 billion share buyback, to be partly funded by selling some upstream assets.
BP's London-listed shares were trading 0.4 percent higher at 1400 GMT, compared with a 0.8 percent gain in the broader European energy index.
The sale ends a disastrous seven-year foray by BHP into shale on which the company effectively blew up $19 billion of shareholders' funds. Investors led by U.S. hedge fund Elliott Management have been pressing the mining company to jettison the onshore assets for the past 18 months. BHP put the business up for sale last August.
The sale price was better than the $8 billion to $10 billion that analysts had expected, and investors were pleased that BHP planned to return the proceeds to shareholders.
"It was the wrong environment to have bought the assets when they did but this is the right market to have sold them in," said Craig Evans, co-portfolio manager of the Tribeca Global Natural Resources Fund.
BHP first acquired shale assets in 2011 for more than $20 billion with the takeover of Petrohawk Energy and shale gas interests from Chesapeake Energy Corp at the peak of the oil boom. It spent a further $20 billion developing the assets, but suffered as gas and oil prices collapsed, triggering massive writedowns.
The world's biggest miner said it would record a further one-off shale charge of about $2.8 billion post-tax in its 2018 financial year results.
The deal, BP's biggest since it bought oil company Atlantic Richfield Co in 1999, will increase its U.S. onshore oil and gas resources by 57 percent.
BP will acquire BHP's unit holding Eagle Ford, Haynesville and Permian Basin shale assets for $10.5 billion, giving it "some of the best acreage in some of the best basins in the onshore U.S.," the company said.
(For a graphic on U.S. oil production, click: tmsnrt.rs/2K1EjdY)
Its bid beat rivals including Royal Dutch Shell and Chevron Corp for the assets, which have combined production of 190,000 barrels of oil equivalent per day (boe/d)and 4.6 billion barrels of oil equivalent resources.
The acquisition could push BP's total U.S. production to 1 million barrels of oil equivalent per day (boe/d) in two years and close to 1.4 million boe/d by 2025, said Maxim Petrov, a Wood Mackenzie analyst.
"The Permian acreage offers the biggest longer-term upside, with some of the best breakevens in the play, well below $50 per barrel," said Petrov.
The deal would turn the onshore United States into "a heartland business in the company," Bernard Looney, BP's head of upstream, said in a call with analysts.
It will bring BP into the oil-rich Permian basin in West Texas, where production has surged in recent years. With it, BP's onshore oil production will jump from 10,000 barrels per day to 200,000 bpd by the mid-2020s, Looney said.
BP said the transaction would boost its earnings and cash flow per share and it would still be able to maintain its gearing within a 20-30 percent range.
The company also said it would increase its quarterly dividend by 2.5 percent to 10.25 cents a share, the first rise in 15 quarters.
Meanwhile, a unit of Merit Energy Company will buy BHP Billiton Petroleum (Arkansas) Inc and the Fayetteville assets, for $0.3 billion.
Tribeca's Evans welcomed the clean exit for cash, rather than asset swaps which BHP had flagged as a possibility.
"It leaves the company good scope to focus on their far better offshore oil business," he said.
BHP Chief Executive Andrew Mackenzie said the company had delivered on its promise to get value for its shale assets, while the sale was consistent with a long-term plan to simplify and strengthen its portfolio.
BHP shares rose 2.3 percent after the announcement, outperforming the broader market and rival Rio Tinto .
BP said it would pay the $10.5 billion in instalments over six months from the date of completion, with $5.25 billion of the consideration to be raised through the sale of new shares.
An Elliott spokesman declined to comment.
Reporting by Sonali Paul, additional reporting by Aditya Soni in Bengaluru and Ron Bousso in London; editing by James Dalgleish, Adrian Croft and Susan Thomas