The 62-36 vote comes after weeks of debate and votes to amend the bill after the House approved it.
The 875-mile (1,400km) pipeline would carry tar sands oil from Alberta, Canada, to the US state of Nebraska where it joins pipes running to Texas.
The White House has previously said Mr Obama will veto the bill.
Spokesman Josh Earnest said the legislation would undermine a "well-established" review process.
Congress would need two-thirds of each chamber of Congress to overcome a presidential veto.
The 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.
Senate Majority leader Mitch McConnell called the bill "an important accomplishment for the country".
"We are hoping the president upon reflection will agree to sign on to a bill that the State Department said could create up to 42,000 jobs and the State Department said creates little to no impact on the environment."
Democratic Senator Barbara Boxer called the bill "a disgrace".
"We tried on our side to make this a better bill and they turned us away."
Among the measures added the bill during the amendment process were energy efficiency measures, as well as on-the-record acknowledgement that climate change was not hoax.
The US president has been critical of the pipeline, saying at the end of last year it would primarily benefit Canadian oil firms and not contribute much to already dropping petrol prices.
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.
A final decision is expected in the upcoming weeks.
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 US Senate has passed a bill to approve the controversial Keystone XL pipeline, sending it to President Barack Obama's desk for a likely veto.