The Dow Jones Industrial Average eked out a gain of 1.81 points to end at 15,545.55, buoyed by Microsoft and Hewlett-Packard. McDonald's led the blue-chip laggards. The Dow traded in a narrow 60-point range.

The S&P 500 logged a four-day rally, adding 3.44 to close at 1,695.53, posting a record closing high. The S&P 500 is on pace for its best monthly gain since October 2011. And the Nasdaq advanced 12.77 points to finish at 3,600.39.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, slid near 12.

Among key S&P sectors, financials led the gainers, while energydipped.

"The Fed is done talking until next week and we're going to be subject to earnings reports and talk from Congress this week," said Brian Battle, vice president of trading at Performance Trust Capital Partners. "We could be in a holding pattern if the market can resist a selloff, but to propel higher, we need better fundamentals…we're still running on Fed liquidity and the pullback caused by the tapering talk has been reversed in the last two weeks."

More than 20 percent of S&P 500 companies have already reported, with 64 percent topping earnings estimates and 50 percent beating on sales, according to the latest data from Thomson Reuters. If all remaining companies post earnings in line with forecasts, earnings will be up 3.1 percent from last year's second quarter.

Yahoo dropped to lead the S&P 500 laggards after the Internet company said it will repurchase 40 million shares of its common stock beneficially owned by Third Point at $29.11 a share and that three directors nominated by Third Point have submitted their resignations.

Apple ticked higher after BMO lifted its target price on the iPhone maker to $480 from $450 with a "market perform" rating.

On the economic front, existing home sales in June slipped 1.2 percent in June to an annual rate of 5.08 million, according to the National Association of Realtors, missing expectations for a reading of 5.25 million units. Still, the reading was still the second-highest level of sales since November 2009.

Meanwhile, NAR's chief economist Lawrence Yun warned that while momentum in the housing market appears to be strong, mortgage rates will have a greater impact on sales in the coming months. He also cautioned that the continuing increase in home prices was unsustainable.

Homebuilders traded in the red following the report, with KB Home and DR Horton leading the biggest laggards.