US Senate leaders have expressed optimism after a flurry of negotiations on raising the US debt ceiling to avert a potentially disastrous default.

Following talks with his Republican counterpart, the Senate's top Democrat spoke of "tremendous progress".

They were also nearing a deal to end a partial government shutdown, now in its third week, congressional sources said.

The US must raise its $16.7tn (£10.5tn) borrowing limit by Thursday or risk failing to pay its bills.

As he toured a soup kitchen for the poor in Washington DC on Monday, President Barack Obama warned that "defaulting would have a potentially devastating effect on our economy".

He was due to hold talks at the White House with congressional leaders that afternoon, but the meeting was postponed to allow Senate leaders more time to cobble together an agreement.

According to US media, congressional leaders have been discussing a deal that would fund the government until 15 January while raising the debt ceiling until early to mid-February.

Senate Democratic Majority Leader Harry Reid told the Senate on Monday evening: "We've made tremendous progress.

"We hope with good fortune, and the support of all of you, recognising how hard this is for everybody, that perhaps tomorrow will be a bright day. We're not there yet."

Republican Senate Minority Leader McConnell also sounded upbeat.

"We've had a good day," he told the chamber. "I think it's safe to say we've made substantial progress and we look forward to making more progress in the future."

John Boehner, the Republican leader and Speaker of the House of Representatives, also met Sen McConnell.

A spokesman for Mr Boehner, Michael Steel, told the Associated Press news agency: "If the Senate comes to an agreement, we will review it with our members."

A closed-door session of Republican senators and representatives was set for Tuesday morning.

Democrats appear to have so far defeated Republican attempts to force any major changes to President Obama's signature healthcare law.

Conservative hardliners were initially vocal in demanding that the White House agree to delay or eliminate the funding for the Affordable Care Act.

However, Senate Republicans are still reportedly pushing for slight modifications to the law. According to US media, they seek stricter measures to verify the incomes of those seeking health insurance subsidies. They also aim to suspend a tax on medical devicess.

Even if a deal is reached in the Senate, it is unclear whether Congress could act in time to pass legislation that would avert the 17 October default deadline.

Hardline conservatives such as Texas Republican Senator Ted Cruz could use Senate rules to stonewall a vote.

A budget bill would also need to pass the House of Representatives, where it could meet fierce resistance from the Tea Party-aligned Republican lawmakers who triggered the whole political deadlock two weeks ago.

One of those conservative hardliners, Kansas Representative Tim Huelskamp, was quoted by the New York Times as labelling his upper chamber colleagues "the Senate surrender caucus".

"Anybody who would vote for that [Senate deal] in the House as Republican would virtually guarantee a primary challenger," he said.

Republicans have taken the brunt of blame for the latest fiscal cliffhanger to cripple Capitol Hill, with some in the party concerned the affair could damage their prospects in next year's midterm elections.

A Washington Post/ABC News poll released on Monday found that 74% of Americans disapprove of the way congressional Republicans have handled the standoff, compared with a 53% disapproval rating for Obama.

Economists, bankers and politicians in both parties have warned for weeks of dire consequences should Congress fail to reach an agreement on raising the nation's debt ceiling.

The US Treasury has been using what are known as "extraordinary measures" to pay its bills since the nation reached its current debt limit in May.

Those methods will be exhausted by 17 October, US Treasury Secretary Jack Lew has said.

Meanwhile, the government remains partially shut down since Congress missed a 1 October deadline to pass a budget, with Congress unable to agree to a law to keep the government funded.

A swathe of federal services are closed while hundreds of thousands of employees are still out of work.