* Trump says he is listening to people on both sides
* Pullout would make U.S. only third nation not in pact
* Democrat Clinton, Republican Romney oppose pullout
* Leaving the deal would take the U.S. years, Juncker says (New throughout, adds comments from EU's Juncker, Elon Musk and Mitt Romney, letter from senators)
WASHINGTON, May 31 (Reuters) - President Donald Trump came under pressure on Wednesday from corporate CEOs, U.S. allies, Democrats and some fellow Republicans to keep the United States in a global pact to fight climate change, while a source close to the matter said Trump was preparing to pull out of the Paris accord.
A U.S. withdrawal could deepen a rift with U.S. allies. The United States would join Syria and Nicaragua as the world's only non-participants in the landmark 195-nation accord agreed upon in Paris in 2015.
Responding to shouted questions from reporters in the White House Oval Office, Trump declined to say whether he had made up his mind, saying, "You'll find out very soon."
"I'm hearing from a lot of people, both ways," Trump said as he met with Vietnamese Prime Minister Nguyen Xuan Phuc. During his 2016 presidential campaign, Trump blasted the accord, and called global warming a hoax aimed at weakening U.S. industry.
The source, speaking on condition of anonymity, said Trump was working out terms of the planned withdrawal with U.S. Environmental Protection Agency Administrator Scott Pruitt, an oil industry ally and climate change doubter.
The pact was the first legally binding global deal to fight climate change. Virtually every nation voluntarily committed to steps aimed at curbing global emissions of "greenhouse" gases. These include carbon dioxide generated from burning of fossil fuels that scientists blame for a warming planet, sea level rise, droughts and more frequent violent storms.
The United States committed to reduce its emissions by 26 to 28 percent from 2005 levels by 2025.
Advocates of the climate deal pressured Trump, who has changed his mind on large decisions before even after signaling a move in the opposite direction.
The chief executives of dozens of companies have made last-minute appeals to Trump. The CEOs of ExxonMobil Corp , Apple Inc, Dow Chemical Co, Unilever NV and Tesla Inc were among those urging him to remain in the agreement. Tesla's Elon Musk threatened to quit White House advisory councils if the president pulls out.
Musk said: "I've done all I can to advise directly" to Trump and through others in the White House.
Robert Murray, CEO of Murray Energy Corp, an Ohio-based coal company and major Trump campaign donor, urged Trump to withdraw from the deal. But on Wednesday, U.S. coal company shares fell alongside renewable energy stocks following reports that Trump would pull out.
Pulling the United States from the accord could further alienate American allies in Europe already wary of Trump and call into question U.S. leadership and trustworthiness on one of the world's leading issues. It also would be one more step by the Republican president to erase the legacy of his predecessor, Democrat Barack Obama, who helped broker the accord and praised it during a trip to Europe this month.
A U.S. pullout could have sweeping implications. The deal relies heavily on reductions in emissions by big polluter nations, and the United States is the world's second-biggest carbon dioxide emitter behind China.
At a conference near Los Angeles, Democrat Hillary Clinton, who Trump defeated in the 2016 presidential election, said withdrawing would be a mistake. "Part of what keeps us going is that America's word is good, and that you stand with your prior administration whether it was of your party or not," she said.
Mitt Romney, the 2012 Republican presidential nominee who Trump considered for secretary of state, said on Twitter that affirmation of the Paris agreement "is not only about the climate: It is also about America remaining the global leader."
Democratic U.S. Senators Bob Menendez and Jack Reed wrote a letter urging Trump not to withdraw. They said withdrawal would undermine U.S. credibility and its position as a global leader, empowering nations like China to drive the climate agenda and set international standards while also reaping economic benefits from a growing clean energy sector.
U.S. allies rallied behind the Paris accord on Wednesday.
In Berlin, European Commission President Jean-Claude Juncker stressed withdrawal would take years, saying, "The Americans can't just leave the climate protection agreement. Mr. Trump believes that because he doesn't know the details."
China and the European Union will seek on Friday to buttress the agreement. In a statement backed by all 28 EU states, the European Union and China will commit to full implementation of the accord, EU and Chinese officials said.
Trump has said the accord would cost the U.S. economy trillions of dollars without tangible benefit. For the Republican president, a withdrawal would reflect his "America First" approach to policy, unencumbered by international obligations.
Trump refused to endorse the accord at a summit of the G7 group of wealthy nations on Saturday in Italy, saying he needed more time to decide.
The Sierra Club said a U.S. withdrawal from the Paris deal would be a "historic mistake." Friends of the Earth said the action would "sacrifice our planet to the fossil fuel industry" and make America the world's "foremost climate villain."
Trump vowed during his 2016 presidential campaign to "cancel" the Paris deal within 100 days of becoming president on Jan. 20, part of an effort to bolster U.S. oil and coal industries.
Trump's advisers have been split about the Paris accord. Senior adviser Steve Bannon, who wants Trump to focus on actions that will rev up his conservative political base, has long opposed it. Jared Kushner, Trumps son-in-law and top adviser, has come to the view that the standards set out in the agreement did not work for the U.S. economy and the question was whether to try to change those standards within the agreement or pull out, another senior administration official said.
Trump's daughter, Ivanka, favors staying in, the official said, and she has sought to ensure her father heard all sides in the debate.
(Reporting by Valerie Volcovici and Jeff Mason; Additional reporting by Roberta Rampton, David Alexander, Doina Chiacu, Chris Kahn, Richard Valdmanis, Timothy Gardner, David Ingram and Rodrigo Campos; Writing by Will Dunham and Doina Chiacu; Editing by Nick Zieminski and Cynthia Osterman)