President Barack Obama and congressional leaders failed to reach a deal to avert a government shutdown but narrowed their differences on Thursday in their struggle to overcome a bitter budget deadlock.

After a nighttime round of tense White House talks, a grim-looking Obama said negotiators would work all night and he expects an answer on Friday morning on whether it is possible to avoid a government closure at midnight on Friday.

There are still a few issues that are outstanding. They're difficult issues. They're important to both sides and so I'm not prepared to express wild optimism, but I think we are further along today than we were yesterday, Obama said.

A shutdown would idle hundreds of thousands of workers, potentially put a crimp on the U.S. economic recovery, and carry political risks for both Democrats and Republicans who would be seen by voters as failing to make compromises.

Obama noted the tremendous impact a shutdown could have on millions of Americans and on the economic recovery and said he had confidence negotiators could make progress overnight.

My hope is ... that I'll be able to announce to the American people sometime relatively early in the day that a shutdown has been averted, that a deal has been completed, said Obama, who canceled a Friday trip to Indiana.

The investment firm Goldman Sachs estimated a government shutdown lasting more than a week could cost the economy $8 billion in missed federal spending.

With time running out, Obama met for an hour on Thursday night with Senate Democratic leader Harry Reid and the top Republican in the U.S. House of Representatives, Speaker John Boehner.

It was their fourth White House meeting in three days.

Democrats blamed the impasse on a Republican push for policy provisions that would block public funding of birth control and stymie environmental protection efforts.

But Boehner said the divisions did not stop there.

There are a number of issues that are on the table. And any attempt to try to narrow this down to one or two just would not be accurate, he said.

Neither side seemed willing as yet to make the final compromise necessary for an agreement.

We have narrowed the issues, however, we have not yet reached an agreement. We will continue to work through the night to attempt to resolve our remaining differences, Reid and Boehner said in a joint written statement.

Their deadline to avoid a shutdown: Midnight on Friday night. Some cable television news broadcasts included a shutdown clock ticking the time down.

The U.S. government prepared to furlough about 800,000 workers and close a variety of federal properties like national parks and museums, as well as many government agencies, such as the Internal Revenue Service.

Vital services such as national defense, law enforcement, emergency medical care and air traffic control would continue.

With the U.S. economy in the early stages of a recovery from the worst recession since the 1930s, the administration warned a shutdown could hit small business owners, applicants for home loans and workers who would be left without paychecks as the result of federal layoffs.

NARROW DIVIDE

The two sides did not seem far apart in their negotiations in terms of dollars, only several billion dollars out of a budget of about $3.7 trillion.

A Democratic congressional aide said a final deal on total spending cuts for the remainder of this fiscal year would probably end up closer to $33 billion than the Republicans' $40 billion target, although a Republican aide said their side was still pushing for closer to $40 billion.

In the hours leading up to Thursday night's meeting at the White House, Reid huddled with his fellow Democrats to give them the latest state of play in the slow-moving negotiations.

Senator after senator came out of that meeting saying they were not optimistic about prospects for averting a shutdown.

Trying to extend the talks a week, House Republicans approved a short-term spending bill with $12 billion in additional spending cuts. It would fund the Defense Department through September 30, the end of the 2011 fiscal year.

Reid called the short-term extension a non-starter in the Senate because of the spending cuts. Obama vowed to veto it.

Democrats attempted to blame fiscal conservatives aligned with the Tea Party movement for pushing the dispute to the brink of a shutdown.

Boehner is under pressure to stand firm in the talks from Tea Party conservatives who helped fuel last year's big Republican elections gains with promises of deep spending cuts and reduced government.

If this government shuts down, and it looks like it's headed in that direction, it's going to be based on our friends in the House of Representatives, the leadership over there, focusing on ideological matters, Reid said.

(Additional reporting by Kim Dixon, Matt Spetalnick, Jeff Mason, Donna Smith, David Alexander, Andy Sullivan and Thomas Ferraro; Writing by Steve Holland; Editing by Vicki Allen and Deborah Charles)