The Dow Jones rose 40.68 points to 18,202.62 while the wider S&P 500 edged up 4 points to 2,144.29.
Oil prices rose over 2% after figures suggested a drop in US stockpiles. Shares in Chevron added 0.5% and Chesapeake Energy climbed 3.1%.
The tech-focused Nasdaq rose just 2.6 points to 5,246.41, with Intel down nearly 6% after its latest results.
Intel reported better-than-expected third-quarter earnings and revenue, but its shares were hit after its forecast for fourth-quarter revenues fell slightly short of expectations.
Intel is predicting revenues of $15.7bn in the quarter, plus or minus $500m, compared with analysts' expectations of $15.86bn.
Morgan Stanley shares rose 1.9% after the bank reported a 62% jump in third-quarter earnings to $1.5bn.
Like the other major US investment banks, Morgan Stanley's results were boosted by a big increase in bond trading, with revenues from that activity rising to $1.5bn in the quarter from $583m a year earlier.
Volumes of bond trading have been strong in recent months, partly due to the UK's vote to leave the EU and also due to speculation about moves in US interest rates.
(Close): US markets closed higher, with energy stocks lifted by rising oil prices.