Treasury Secretary Janet Yellen speaks at Johns Hopkins University School of Advanced International Studies in Washington, D.C., April 20, 2023. [AP Photo]

President Joe Biden said a deal to raise the government's debt ceiling seemed "very close" late Friday, even as the deadline for a potentially catastrophic default was pushed back to June 5.

The later date, laid out in a letter from Treasury Secretary Janet Yellen, set the risk of a devastating default four days later than an earlier estimate. It came as Americans and the world uneasily watched the negotiating brinkmanship that could throw the U.S. economy into chaos and sap world confidence in the nation's leadership.

Yet Biden was upbeat as he left for the Memorial Day weekend at Camp David, declaring, "It's very close, and I'm optimistic."

With Republicans at the Capitol talking with Biden's team at the White House, the president said: "There's a negotiation going on. I'm hopeful we'll know by tonight whether we're going to be able to have a deal."

In a blunt warning, Yellen said failure to act by the new date would "cause severe hardship to American families, harm our global leadership position and raise questions about our ability to defend our national security interests."

Anxious retirees were making contingency plans for missed checks, with the next Social Security payments due next week.

Biden and Republican House Speaker Kevin McCarthy seemed to be narrowing on a two-year budget-slashing deal that would also extend the debt limit into 2025 past the next presidential election. After many rounds of closed-door talks, a compromise had appeared to be nearing on Friday.

Republicans have made some headway in their drive for steep spending cuts that Democrats oppose. However, the sides are particularly divided over McCarthy's demands for tougher work requirements on government food stamp recipients that Democrats say is a nonstarter.

Any deal would need to be a political compromise, with support from both Democrats and Republicans to pass the divided Congress. Failure to lift the borrowing limit, now $31 trillion, to pay the nation's incurred bills would send shock waves through the U.S. and global economies.

But many of the hard-right Trump-aligned Republicans in Congress have long been skeptical of Treasury's projections, and they are pressing McCarthy to hold out.

"The deal's within reach. It just has to be agreed to," said Representative Patrick McHenry, a North Carolina Republican who is one of the negotiators.

In optimistic comments earlier at the White House, before Yellen's letter was released, Biden gave a shout-out to one of his top negotiators, saying she's "putting together a deal, hopefully."

He was referring to Office of Management and Budget Director Shalanda Young, who attended a salute to the Louisiana State women's national basketball champions.

While the contours of the deal have been taking shape to cut spending for 2024 and impose a 1% cap on spending growth for 2025, the two sides remain stuck on various provisions.

"The world is watching," International Monetary Fund Managing Director Kristalina Georgieva said after meeting Friday with Yellen. "Let's remember we are now in the 12th hour."

Weeks of negotiations between Republicans and the White House have failed to produce a deal - in part because the Biden administration resisted negotiating with McCarthy over the debt limit, arguing that the country's full faith and credit should not be used as leverage to extract other partisan priorities.

"We have to spend less than we spent last year. That is the starting point," said McCarthy.

Meanwhile, McCarthy is feeling pressure from the House's right flank not to give in to any deal, even if it means blowing past the Treasury deadline.

McCarthy said Donald Trump, the former president who is again running for office, told him, "Make sure you get a good agreement."

Watchful Democrats, though, are also pressing Biden. The top three House Democratic leaders, led by Representative Hakeem Jeffries, spoke late Thursday with the White House.

McCarthy has promised lawmakers he will abide by the rule to post any bill for 72 hours before voting. The Democratic-held Senate has vowed to move quickly to send the package to Biden's desk.

Meanwhile, Fitch Ratings agency placed the United States' AAA credit on "ratings watch negative," warning of a possible downgrade.

The White House has continued to argue that deficits can be reduced by ending tax breaks for wealthier households and some corporations, but McCarthy said he told the president as early as their February meeting that raising revenue from tax hikes was off the table.