BANGKOK, Jan 12 (Reuters) - ExxonMobil has agreed to sell its two-thirds stake in Esso Thailand to Thai energy firm Bangchak Corporation, the companies said, in a deal valued at about 20.1 billion baht ($603 million).

Bangchak shares closed up 9% while Esso Thailand, which closed at 11.2 baht on Wednesday, fell 17% after the companies made the announcement in separate statements.

ExxonMobil's shares traded up about 1%.

"The final price will be based on Esso Thailand's latest quarterly earnings after conditions are finalised," Bangchak chief executive Chaiwat Kovavisarach told a news conference.

Bangchak said in a statement it would buy Esso Thailand shares at an indicative price of 8.84 baht per share, putting the firm's enterprise value - which also includes debt and cash - at 55.5 billion baht based on its third quarter earnings.

"There will be synergy and cost savings of between 1.5 billion baht to 2 billion baht per year," Banchak CEO said.

The sale includes the Sriracha oil refinery, select distribution terminals and a network of Esso-branded retail fuel stations, which will later be re-branded to Bangchak.

ExxonMobil said it would "continue to supply the Thailand market with branded finished lubricants and chemical products through a new company to be formed", while it focuses its investment on global production facilities.

Bangchak said it would initially buy ExxonMobil's 65.99% stake and then launch a tender offer for remaining shares, held mainly by institutional funds at the same price.

The transaction is expected to close in the second half of 2023, subject to regulatory approvals.

The deal will be funded by cash on hand and bank loans, Bangchak said, noting it would add refining capacity of 174,000 barrels per day and 700 service stations.

"Debt-to-equity ratio not to exceed two times after the deal," Bangchak vice president for finance, Phatpuree Chinkulkitnivat said.

($1 = 33.3500 baht) (Reporting by Ashitha Shivaprasad in Bengaluru and Chayut Setboonsarng ; Editing by Christian Schmollinger, Kenneth Maxwell and Tomasz Janowski)