Congress is injecting nearly $3 billion into the Children's Health Insurance Program to keep it funded through March. The money is included in a short-term spending bill to keep the federal government open.

Though CHIP is popular on both sides of the political aisle, its funding ended on Sept. 30, and Congress has failed to reauthorize a long-term appropriation for it. States had started warning that children would lose their coverage if lawmakers didn't act fast.

Parents have been pleading with Congress to keep their children insured. Even Jimmy Kimmel urged Americans to tell their representatives to fund the program.

The federal government was set to shut down Friday as Republicans grappled with how to fund it before the end of the year. The GOP passed another short-term solution Thursday that will get them through the middle of January.

Related: Parents to Congress: My child depends on CHIP for health insurance

CHIP covers about 9 million children whose parents usually earn too much to qualify for Medicaid, but not enough to afford private health coverage -- typically no more than $62,000 for a family of four. The 20-year-old program cost about $15.6 billion in fiscal 2016, funded almost entirely by the federal government.

States have been able to keep their CHIP programs going since the federal funding expired by using their unspent allotments and with grants from the federal Centers for Medicare & Medicaid Services.

Some 1.9 million children were at risk of losing coverage in January, according to a recent report by the Georgetown University Health Policy Institute. The number would have grown by another million children by the end of February.

Related: More than a million children could lose their health insurance next year

Alabama announced earlier this week that it would stop enrolling children in its CHIP program, titled ALL Kids, on Jan. 1, and would terminate coverage for all children at the end of January if federal funding weren't renewed. Connecticut, meanwhile, said it would discontinue its HUSKY B program on Jan. 31.

Those states joined Colorado, Utah and Oklahoma, which had already warned that coverage may end or be reduced in coming months.

Related: Jimmy Kimmel brings out his son to talk about health care

Not every state could simply end coverage for children. It depends on how they set up their programs. Some 5.2 million kids live in states that would have had to continue the coverage, but would have had to foot more of the cost themselves.

Another 3.7 million kids live in states that could simply terminate the policies, and 1.2 million of them could have become uninsured if they couldn't afford alternate coverage, according to the Medicaid and CHIP Payment and Access Commission.

Related: After Kimmel, here's where the CHIP program stands

While both Republicans and Democrats said they support fully funding CHIP, they differed in how to pay for it.

CNN's Lauren Fox contributed to this report.