* Apple shares up 5.1 pct, help Nasdaq squeak out a gain
* Caterpillar, AT&T weigh on Dow
* Boeing hits lifetime high before turning negative
* Facebook, Baidu fly in after-hours trading on results
* Dow down 0.2 pct, S&P 500 off 0.4 pct, Nasdaq up 0.01 pct
U.S. stocks mostly retreated on Wednesday as losses in utility and commodity shares more than offset gains in the tech sector on Apple's solid earnings.
The Dow Jones industrial average ended slightly lower on the day after closing at a record high. Caterpillar and AT&T dragged on the Dow following weak results on a day when earnings were mixed, with better-than-expected news from Boeing Co But blue-chip Boeing's stock also ended the day lower.
The benchmark S&P 500 logged its first back-to-back declines in a month. On Tuesday, the S&P 500 closed slightly lower after setting a record intraday high of 1,698.78.
The tech-driven Nasdaq barely finished in positive territory, eking out a gain of less than a point despite a 5.1 percent jump in shares of Apple.
Peter Jankovskis, co-chief investment officer of OakBrook Investments LLC in Lisle, Illinois, said investors are in a "wait-and-watch" phase as earnings come out.
"They gave us a lift during the first half of the month, and they're now having a difficult time sustaining that momentum," he said. "I think the pop that we're going to get out of earnings has already occurred."
Shares of Facebook Inc surged 20.1 percent in extended-hours trading after the company said its revenue in the second quarter increased 53 percent, surpassing Wall Street's targets. During regular trading, Facebook's stock rose 1.5 percent to end at $26.51, ahead of its results.
Shares of Baidu Inc shot up 12.2 percent in extended-hours trading after China's largest search engine posted slightly better-than-expected revenue of $1.23 billion in the second quarter. Baidu's stock ended regular trading at $113.37, up 3.2 percent ahead of its earnings.
During Wednesday's regular session, stocks declined across the board, with nine of the 10 S&P 500 industry sector indexes moving lower. The utilities index was the worst performer, shedding 1.6 percent, while the materials and energy indexes fell nearly 1 percent apiece.
The Dow Jones Industrial Average slipped 25.50 points, or 0.16 percent, to end at 15,542.24 - a day after closing at a record 15,567.74. The Standard & Poor's 500 Index fell 6.45 points, or 0.38 percent, to finish at 1,685.94.
But the Nasdaq Composite Index inched up 0.33 of a point, or 0.01 percent, to close at 3,579.60.
Analysts said the stock market was pausing as investors booked profits after a sizable upward move over the past month. The S&P 500 has added as much as 7.8 percent since late June, and it has set some record closing highs along the way.
Tech bellwether Apple rose 5.1 percent to $440.51 a day after it reported earnings and revenues that beat Wall Street's estimates, helping to keep the Nasdaq afloat and bolster the S&P 500's tech shares as well. The S&P tech sector index rose 0.86 percent to end at 506.92, after climbing as much as 1.4 percent earlier in the day.
Caterpillar and AT&T, on the other hand, disappointed investors after posting results. Caterpillar shares fell 2.4 percent to $83.44. AT&T shares tumbled 1.2 percent to $35.40.
Boeing, also a Dow component, posted upbeat second-quarter results, but the stock fell 0.8 percent to close at $106.95 after hitting a lifetime high of $109.48 earlier in the session.
Broadcom shares tumbled 15.1 percent to $27.01 a day after the chipmaker forecast lower-than-expected third-quarter revenue. At least four brokerages cut their ratings and about 10 lowered their price targets on Broadcom's stock.
Of the 169 companies in the S&P 500 that have reported results so far this season, 65.7 percent have beaten analysts' expectations for earnings and 53.3 percent posted revenue above forecasts. Over the past four quarters, 67 percent of companies have beaten earnings estimates.
Shares of little-known uranium company USEC Inc gained for a ninth consecutive day, extending a meteoric rise. On Wednesday, the stock leaped 7.1 percent to end at $13.35.
About 6.2 billion shares changed hands on U.S. exchanges, slightly below the daily average of about 6.4 billion.
Decliners outnumbered advancers on the New York Stock Exchange by a ratio of 3 to 1. On the Nasdaq, three stocks fell for every two that rose.