The S&P 500 closed out its best week in three months with a slim gain on Friday as investors continued to propel equities near four-year highs.

Two slightly softer economic reports curbed broader gains, keeping both the Dow and the Nasdaq in modestly negative territory. The Dow broke a string of seven straight gains. Had it closed higher, it would have marked the Dow's longest such run in more than a year.

The benchmark Standard & Poor's 500 index rose for a fifth straight week, gaining 2.4 percent in its best weekly performance since mid-December. Investors, buoyant over the economic outlook, have pushed the S&P above 1,400 to its highest level since May 2008 after a surge of almost 30 percent from its most recent closing low on October 3.

Energy shares were the big gainers of the day. The S&P energy index <.GSPE> rose 1.2 percent in sync with a jump in crude prices, which advanced on continuing tensions over Iran's disputed nuclear program and the potential for supply disruptions in the region. Occidental Petroleum rose 1.7 percent to $100.58.

Fundamentals are improving, corporate profits are rising, and the market has really good upward momentum, said Stephen Wood, chief market strategist at Russell Investments in New York, which has about $140 billion in assets under management.

I think we still have room to rise, but that said, we're keeping an eye on oil, which could be a destabilizing factor if it gets too high.

The Thomson Reuters/University of Michigan's preliminary reading on the overall index on consumer sentiment slipped to 74.3 from 75.3 in February, shy of economists' forecasts for a gain to 76.0 as climbing energy prices pushed inflation expectations higher for next year.

Separate data on Friday showed factory output edged higher last month, despite a fallback in auto production. However, overall industrial output was flat, held back by a second straight monthly decline in mining activity.

The Dow Jones industrial average <.DJI> slipped 20.14 points, or 0.15 percent, to 13,232.62 at the close. The Standard & Poor's 500 Index <.SPX> edged up 1.57 points, or 0.11 percent, to 1,404.17 - its highest close since May 20, 2008. The Nasdaq Composite Index <.IXIC> dipped 1.11 points, or 0.04 percent, to 3,055.26.

For the week, the Dow gained 2.4 percent and the Nasdaq was up 2.2 percent. The lion's share of the week's gains came on Tuesday, when positive comments from the U.S. Federal Reserve and JPMorgan Chase & Co sparked a late-day rally.

Elsewhere on the economic front, the Labor Department said its Consumer Price Index increased 0.4 percent last month after advancing 0.2 percent in January, matching expectations, while inflation pressure, measured by the core CPI excluding food and energy, remained subdued.

Credit Suisse analyst Andrew Garthwaite raised his year-end 2012 target on the S&P 500 to 1,470 from 1,400, noting equities are now 9 percent above their six-month moving average - but when this has happened, equities have typically risen by 7 percent over the following six months.

The latest round of economic data, although softer than hoped, did little to dent that thesis, though some remained leery that equities could be ripe for a pullback as the CBOE Volatility Index or VIX <.VIX> slid 6.2 percent to close at 14.47, its lowest since June 2007.

This week marked the quarterly expiration and settlement of March equity futures and options, an event known as quadruple witching. As a result, volume was higher than it has been in recent sessions. About 7.89 billion shares traded on the New York Stock Exchange, the NYSE Amex and the Nasdaq, slightly above last year's daily average of 7.84 billion.

U.S.-listed shares of Transocean Inc climbed 4.6 percent to $58.70 a day after it secured three new contracts at a higher rate.

Apple Inc closed flat at $585.57 as its new iPad proved to be another hot seller on Friday, as expected. Hundreds of iPad fans lined up at stores across Asia to be the first to get their hands on the tablet computer.

Several banks, including Goldman Sachs Group , have shown an interest in buying American International Group Inc's complex and troubled assets tied to the insurer's bailout, the Wall Street Journal said, citing people familiar with the matter. Goldman Sachs lost 0.1 percent to $122.93, while AIG shares fell 0.2 percent to $28.03.

About 53 percent of stocks traded on the New York Stock Exchange closed in negative territory on Friday, while the number of advancers and decliners on the Nasdaq was about even.

(Editing by Jan Paschal)