The S&P 500 climbed 0.33% to close within reach of its all-time high for the third day in a row as crude oil settled at the highest since last summer. 

The Dow Jones Industrial Average added 0.37% to close about 18,000, while the Nasdaq rose 0.26% and remains negative for 2016.

Crude oil propelled minor gains for equities throughout the markets, pushing benchmark indexes to year-to-date highs. The commodity closed above $51 a barrel for the first time since last July after the Energy Information Administration reported a 3.2-million-barrel decline in domestic inventories in the past week. The data was slightly less than the 3.6-million-barrel drop reported by the American Petroleum Institute a day earlier.

Prices have been buoyed recently as supply disruptions in Canada and Nigeria and a general downward trend in U.S. production relieved some of the global supply-demand imbalance. West Texas Intermediate crude climbed 1.7% to $51.23 a barrel on Wednesday.

"The oil market has a better feeling to it, as some signs of improving fundamentals and continued non-OPEC members' problems linger," said Peter Cardillo, chief market economist at First Standard Financial. "We continue to see firmer oil prices with a new higher trading range unfolding between $50 and $52.50 during the summer months."

The number of job openings rose 5.8 million in April, up from a downwardly revised 5 million in March, according to the Job Openings and Labor Turnover Survey. The hiring rate slid to 3.5% from 3.7%.

Morgan Stanley (MS - Get Report) shares were active after the Securities and Exchange Commission leveled a $1 million fine against the bank for allegedly failing to protect sensitive customer information. Morgan Stanley agreed to the penalty, though it didn't admit wrongdoing.

Lululemon (LULU - Get Report) rose despite offering a weaker outlook for its current quarter. The yogawear retailer expects same-store sales to rise in the mid-single digits in its second quarter with earnings no higher than 38 cents a share. Profit guidance missed consensus by a penny. Excluding currency exchange, sales at existing stores rose 5% in its first quarter.

Yahoo! (YHOO) kicked off an auction for a portfolio of about 3,000 patents expected to fetch more than $1 billion, The Wall Street Journal reported. Preliminary bids for the patents have a mid-June deadline. The beleaguered Internet company is also currently seeking potential bids for its core assets with a number of suitors, including Verizon (VZ - Get Report)  ,  reportedly expressing interest.

Lending Club (LC - Get Report)  rose on reports former CEO Renaud Laplanche is speaking with private-equity firms and banks to potentially take the company private. Laplanche, who stepped down last month, is currently seeking financing for a possible takeover.

Ralph Lauren (RL - Get Report) was upgraded to neutral from underperform with a $96 price target at Bank of America. Analysts said the company is cutting costs and estimates appear to be bottoming.