Oil for November delivery rose $1.08, or 1.1 percent, to $102.29 a barrel on the New York Mercantile Exchange. Most other energy futures rose.
Stocks and bonds rallied after Senate leaders announced they had reached a compromise on extending the government's borrowing authority and reopening the government. Energy futures also rose as a potential threat to U.S. financial markets and the economy appeared to wane.
Congress raced to pass the legislation Wednesday ahead of a Thursday deadline after which the government would exhaust its ability to borrow money to pay its bills, putting the U.S. at risk of defaulting on its debt.
In other energy trading, wholesale gasoline rose 4 cents to $2.70 a gallon, natural gas fell 2 cents to $3.77 per 1,000 cubic feet and heating oil gained 2 cents to $3.04 a gallon.
Gold for December delivery edged up $9.10 to $1,282.30 an ounce. Other metals futures also rose.
December silver rose 17.4 cents to $21.365 an ounce, January platinum rose $14.80 to $1,398.20 an ounce and December palladium rose $7.25 to $713.55 an ounce.
High-grade copper for December delivery was unchanged at $3.308 a pound.
Crop futures ended mixed.
December wheat fell 4.25 cents to $6.815 a bushel, December corn fell three-quarters of a cent to $4.4275 a bushel and November soybeans fell 9.5 cents to $12.765 a bushel.