Dow, S&P 500 inch closer to all-time highs

Energy companies led U.S. stocks higher Wednesday as the price of oil rebounded on reduced U.S. production and thinking OPEC producers would meet next in May.

Scaling back from triple-digit gains, the Dow Jones industrial average (I:DJI) rose 43 points, or 0.2 percent, to 18,096.27, leaving it 216 points from its highest recorded close of 18,312.39, which came on May 19, 2015.

The Standard & Poor's 500 index added nearly two points, or 0.1 percent, to 2,102.40, edging nearer to its May 21 record close of 2,130.82.

The Nasdaq composite index gained almost 8 points, or 0.2 percent, to 4,948.

After several weeks of moving in different directions, the stock market appears to be getting more closely tied to the fluctuations in oil prices.

"Oil is what's been driving the market lately," said Chris Gaffney, president of EverBank World Markets.

Climbing oil and natural gas prices helped lift shares in several energy companies.

Discover Financial Services climbed after the credit card issuer and lender reported better-than-anticipated quarterly profit and sales as loan volume improved.

VMWare jumped after the cloud-computing company reported better-than-expected earnings. Lexmark International surged after the printer maker agreed to be bought by a group that includes Apex Technology and PAG Asia Capital for about $2.51 billion.

Yahoo rose a day after the Internet pioneer said that it is considering the sale of part or all of its Internet business. The news overshadowed its latest quarterly loss.

Coca-Cola slid after the world's biggest beverage maker reported a lower profit for the first quarter. The company was squeezed by a strong dollar and charges related to the transformation of its North American operations.

Angie's List slid after the online ratings service reported an unexpected loss and disappointing sales in the first quarter.

U.S. crude reversed an early morning slide to settle at $42.63, up $1.55 or 3.77 percent.

Crude production declined to 8.95 million barrels in the week ending April 15th, data from the Energy Information Administration showed.

And, Iraq's oil minister said major producers could gather next month in another bid to freeze output.