SHANGHAI, Nov 5 (Reuters) - The yuan ended the domestic trading session at a 28-month high on Thursday as growing prospects of a Joe Biden presidency in the United States raised investor expectations of a less problematic trade relationship between the world's two largest economies.

Victories in Michigan and Wisconsin gave Biden a critical boost in the race against President Donald Trump to obtain 270 votes in the state-by-state Electoral College needed to win the White House.

The onshore spot yuan finished domestic trading session at 6.64 per dollar, its strongest such close since July 10, 2018.

The yuan had a roller-coaster ride in the previous two days, swinging from an over-three-week low to a near-28-month high, as investor sentiment was heavily affected by the dollar's reaction to the fast-changing election dynamics.

"The USD/CNH was perhaps the most reactive pair to the odds of a Trump upset," said Terence Wu, FX strategist at OCBC Bank.

"The prospects of a Biden win, and perhaps a more conventional and rules-based trade policy, eventually pushed the pair to close at a low of 6.6200, our target for an RMB-positive election outcome."

Many investors expect a Biden presidency to benefit the yuan, as he is more likely to adopt a multilateral approach and less likely to prolong Trump's trade war, which has weighed on the Chinese currency over the last two years.

However, Zhou Hao, an economist at Commerzbank in Singapore, said market optimism about an easing of Sino-U.S. tensions might not last too long.

"While Biden is also likely to take a hard approach on China, the new administration might need some time to frame the new policy, which might give China some room to breathe," he said.

"In the meantime, there is still a risk that the election could fall into a toss-up status, which also means U.S. foreign policy could be dysfunctional for a while. All told, the market is leaning towards CNY-positive for the time being, while everyone knows that the U.S.-China conflict will ultimately come up."

Prior to market opening, the People's Bank of China set the midpoint rate at 6.6895 per dollar, 124 pips or 0.19% weaker than the previous fix of 6.6771. (Reporting by Winni Zhou and Andrew Galbraith; Editing by Sam Holmes and Kevin Liffey)