Dow Jones industrial average closed up 35 points, or 0.2 percent, to 17,576.96, the S&P 500 gained 5.69 points, or 0.28 percent, to 2,047.6 and the Nasdaq Composite added 2.32 points, or 0.05 percent, to 4,850.69.
A sharp rally in crude oil and energy shares lifted US stocks on Friday, but indexes registered losses for the week.
US crude oil settled more than 6 percent higher after data showed lower US stockpiles, driving gains of 2 percent in the S&P energy index.
In the latest comments from Federal Reserve officials, Fed Chair Janet Yellen said late on Thursday the US economy was on "a solid course," while New York Fed President William Dudley said on Friday a cautious and gradual approach to raising rates was appropriate.
Investor focus should shift next week from oil and the Fed to quarterly reports, said Peter Kenny, senior market strategist at Global Markets Advisory Group, in Berkeley Heights, New Jersey.
"The Street is not expecting much in Q1 earnings, but right now the market is moving as a direct result of dovish commentary from the Fed and crude's ability to rally. That is good news for investors but I'm not sure how long of a shelf life that has," he said.
First-quarter earnings begin in earnest next week with reports from Alcoa and four of the big banks. Analysts are projecting a third straight quarterly decline in earnings at S&P 500 companies, with a 7.6-percent year-over-year decline in profits forecast, according to Thomson Reuters data.
Some strategists, though, expect more companies than usual to beat extremely low estimates, possibly helping stocks gain in the short term.
The Dow Jones industrial average closed up 35 points, or 0.2 percent, to 17,576.96, the S&P 500 gained 5.69 points, or 0.28 percent, to 2,047.6 and the Nasdaq Composite added 2.32 points, or 0.05 percent, to 4,850.69.
For the week, the Dow and S&P 500 lost 1.2 percent, while the Nasdaq fell 1.3 percent.
S&P 500's weekly loss was its biggest since early February. The index has mostly rallied since mid-February as oil prices rebounded and worries over China eased.
A drop in shares of biotechs and other healthcare companies kept a lid on gains in the Nasdaq and the broader market, with the Nasdaq Biotech index .NBI down 1.1 percent on the day.
Valeant Pharmaceuticals fell 5.2 percent to USD 33.67 after Bill Ackman said that the Canadian drugmaker would not sell Bausch and Lomb.
Gap sank 13.8 percent to USD 23.85 after the company's disappointing same-store sales for March prompted Citigroup to cut its price target on the stock.
Volume was light. About 6.3 billion shares changed hands on US exchanges, below the 7.1 billion daily average for the past 20 trading days, according to Thomson Reuters data.
Advancing issues outnumbered declining ones on the NYSE by 2,300 to 730, for a 3.15-to-1 ratio on the upside; on the Nasdaq, 1,602 issues rose and 1,205 fell for a 1.33-to-1 ratio favoring advancers.
The S&P 500 posted 18 new 52-week highs and one new low; the Nasdaq recorded 30 new highs and 23 new lows.
Unlock 75% more savings this festive season. Get Moneycontrol Pro for a year for Rs 289 only.
Coupon code: DIWALI. Offer valid till 10th November, 2019 .