WASHINGTON (USA TODAY) — With the threat of another government shutdown looming, the Senate was poised to pass a massive two-year budget agreement Thursday that would pave the way for more than $400 billion in increased defense and domestic spending and raise the nation's borrowing limit for a year.

The deal — negotiated by congressional leaders and released late Wednesday night — must still clear several procedural hurdles in the Senate. And the timing for a final vote in that chamber remained unclear.

If the Senate approves the measure, the 652-page budget bill would then go to the House, where it faces stiff opposition from liberal Democrats and conservative Republicans.

That budget agreement would eliminate strict budget caps set in 2011 to reduce the federal deficit — paving the way for Congress to increase defense spending by $165 billion and hike domestic spending by $131 billion over the next two years.

The measure is stuffed with other fiscal provisions, including a major disaster relief package for regions hard-hit by last year’s devastating storms and a one-year suspension of the debt limit, the amount the U.S. Treasury can borrow to pay the nation's bills.

President Trump offered a full-throated endorsement of the deal in a Wednesday evening tweet, saying "Republicans and Democrats must support our troops and support this Bill."

Senate Republican Leader Mitch McConnell of Kentucky and Senate Democratic Leader Charles Schumer of New York have both championed the agreement as a bipartisan breakthrough that would end the destabilizing cycle of short-term spending bills that lawmakers have had to pass repeatedly to keep the lights on at government agencies.

"No one would suggest it's perfect, but we worked hard to find common ground and stay focused on serving the American people,” McConnell said Wednesday.

With backing from the two Senate leaders, the bill is expected to win bipartisan support in that chamber. But its fate in the House remains unclear, with both Democrats and Republicans facing internal party divisions over the deal.

Defense hawks and moderate Republicans said it's a strong compromise that will provide a much-needed boost to the military.

"If you vote no, you’re voting against fixing the military," Rep. William "Mac" Thornberry, R-Tx., chairman of the House Armed Services Committee, said Wednesday.

But conservatives called it a budget-busting proposal that would further sink the country in a sea of red ink.

"It's a plus-up on everything," said Rep. Dave Brat, R-Va., a member of the ultra-conservative House Freedom Caucus. "It's a Christmas tree on steroids."

Democrats are also conflicted because while the deal would increase spending for their favored domestic programs, the agreement does nothing to protect the DREAMers, the undocumented immigrants brought to the U.S. as children.

House Democratic leader Nancy Pelosi delivered a record-breaking 8-hour speech on the House floor Wednesday, telling the stories of DREAMers without a break to object to the budget plan's failure to protect those immigrants.

If conservative Republicans in the House oppose the agreement, House Speaker Paul Ryan, R-Wis., will need a significant number of Democratic votes to get it passed. But Rep. Steny Hoyer, of Maryland, the Democratic whip, urged his members to line up in opposition to the deal.

“This package leaves DREAMers isolated, without a path to resolution in the House,” Hoyer's notice to House Democrats states.

Congress faces an imminent deadline to deal with the spending issue. Current federal funding runs out at midnight on Thursday, and if Congress does not pass a new spending bill, it will trigger a partial government shutdown.

The House on Tuesday passed its fifth stop-gap spending bill, a proposal that would fund domestic programs through March 23 and also give the Pentagon a full-year budget of $659 billion. Democrats strongly oppose that measure because they say it short-shrifts domestic spending.

The Senate rejected that House-passed bill on Thursday and is expected to replace the short-term spending bill with the broader budget agreement later Thursday afternoon.

If it passes both chambers, it would give Congress six weeks to craft a spending bill for the rest of 2018 that meets the new budget targets before the government runs out of money again.

Contributing: Michael Collins and Nicole Gaudiano