The Senate voted by 59-41 in favor of the bill, but this was one vote short of the 60 needed to pass it.
The 1,179-mile pipeline would carry tar sands oil from Alberta, Canada, to Nebraska where it joins pipes running to Texas.
Republicans have vowed to approve the bill next year when the new Congress convenes.
The current Senate is controlled by the Democratic Party, but Republicans will control the next Senate, following gains in elections earlier this month.
President Barack Obama is said to take a “dim view” of the legislation, but has not directly threatened a veto in the event of the bill reaching the White House.
The pipeline project has pitted Republicans and other supporters – who say it will create much-needed jobs – against many Democrats and environmentalists who warn the pipeline will add to carbon emissions and contribute to global warming.
Republicans maintained their majority in the House and gained control of the US Senate during mid-term elections on November 4. But the official start of the new Congress is not until early January.
The bill failed to pass despite all 45 current Republican senators as well as 14 Democrats voting in favor.
The proposed XL pipeline has the same origin and destination as an operational pipe, also called Keystone but takes a more direct route and has a wider diameter.
It would daily carry 830,000 barrels of mostly Canadian-produced oil from the oil sands in Alberta, Canada, to refineries in Steele City, Nebraska and then on to the Texas coast for export.
The southern section to the Gulf opened in January 2014.
It is a privately financed project, with the cost of construction shared between TransCanada, an energy company based in Calgary, Alberta, and other oil shippers.
A state department report raised no major environmental objections in February, but the final recommendation was delayed amid a court battle over the project in Nebraska.
The state department is involved because the pipeline would cross an international border.
The Keystone XL pipeline aims to carry some 830,000 barrels of heavy crude a day from the fields in Alberta to Nebraska.
The oil would then be transported on existing pipes to refineries in Texas. The southern section of the project was finished last year.
The bill passed easily in the House last week with a 252-161 vote, but it was not the first time the chamber had voted to approve the project.
The bill’s sponsor, Louisiana Representative Bill Cassidy, is facing a run-off election against incumbent Democratic Senator Mary Landrieu for her seat.
Mary Landrieu – among the pipeline’s Democratic supporters – successfully pushed the Senate to hold the vote on the measure on November 18 and urged backing for the measure.
_afwNlllSo4Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…