WASHINGTON (CNN) -- Congress narrowly averted a government shutdown that was slated to take effect at midnight. The House approved a $1.1 trillion spending bill that keeps the government open through September. The Senate agreed to a two-day extension of current funding levels to give itself time to approve the House bill.
After a tumultuous day, the House passed the spending bill in a 219-206 vote.
The Senate will likely vote on the House bill on Friday, though that could slip. President Barack Obama is expected to sign it into law once it passes the Senate.
The bill would keep most of the government running through the end of September, but only funds the Department of Homeland Security through February, when Republicans have vowed to pass new restrictions on the agency responsible for carrying out Obama's executive orders on immigration.
The bill garnered significantly more support from Republicans than Democrats. Those who did support it may have headed pleas from White House officials -- including Obama and Vice President Joe Biden -- pressing them to advance the spending bill.
White House Chief of Staff Denis McDonough also urged Democratic lawmakers during a late-Thursday caucus meeting to vote for the bill because they would lose much of their leverage on future spending bills, lawmakers at the meeting said.
Democratic Rep. John Larson of Connecticut said the lobbying from the President had helped move things along with the caucus.
"Obviously, I think the President also getting on the phone -- some working the respective caucuses -- was influential," he told CNN.
But many progressives were outraged at the bill's passage and suggested it would undermine Democrats' effectiveness down the line.
"What I see is our Democratic Party -- in a weakened position and trying to protect our constituents and the people. And at the same time having to make some terrible choices," said California Rep. Maxine Waters, a key Democratic opponent of the bill, after the vote.
She said the vote was an example of "the old politics of fixing things around the edges so that you can feel better, rather than putting up a strong fight" and standing against Republican attempts to insert unpalatable policies into bills, which she suggested is more likely next year when Republicans take full control of Congress.
Other Democrats, however, saw the bill's passage as a triumph of cooperation between the two parties, and a signal that they can move past the gridlock and dysfunction that's plagued Washington for years.
"It's an economic message of, we can get something done. We're not going to always be dysfunctional, and I think that's a welcome message for voters," said Rep. Gerry Connolly, a Virginia Democrat. "They want to see that. And we don't lose a thing."
The vote capped a day of drama in the House. The chamber recessed for nearly seven hours as leaders scrambled to find votes to move the bill across the finish line. The chaos was fitting for a Congress that has already gone through one government shutdown and has been generally characterized by turmoil and inertia.
If anything, Thursday's tumult highlighted the disconnect between Obama and congressional Democrats. Nancy Pelosi, the House Democratic leader, came out in strong opposition to the measure even as Obama was pressing her members to back it.
Democrats aligned with Pelosi took issue with policy provisions added to the bill raising the cap on donations to political parties and rolling back a key plank of the Dodd-Frank financial reform bill.
"This bill puts a big bow on a holiday gift for the Wall Street contributors who get special treatment in the provisions of this bill," Rep. Lloyd Doggett, D-Texas, said ahead of the vote. "It's all about stuffing the silk stockings, and these people want to gamble with our money."
Conservative Republicans, meanwhile, fought the bill because they were angry that it didn't combat Obama's executive action on immigration.
It became clear earlier Thursday that Speaker John Boehner would have a tough time getting the package through the House. The chamber barely approved a routine procedural hurdle that sets up a vote on the spending bill later in the day. In an unusual move, Boehner was called upon to provide a key vote so the House could advance to the bill.
Though congressional leaders worked on backup options in case this bill failed, the Office of Management and Budget still discussed contingency plans on Thursday if the government was unable to open on Friday.
CNN's Dana Bash contributed to this story.