The closed at a record Friday, helped by gains in technology stocks on the last trading day of the quarter.

The tech-heavy Nasdaq composite rose more than half a percent to post its 50th record close for this year. The Dow transports and small-cap Russell 2000 also hit record highs.

The Dow Jones industrial average closed up nearly 24 points, within 0.1 percent of its record high. Goldman Sachs contributed to the most to gains in the index.

The index posted quarterly gains of 4.9 percent its eighth straight quarter of gains for the first time since 1997.

The S&P 500 rose nearly 4 percent in the quarter, also its eighth straight quarter of gains. The Nasdaq composite gained almost 5.8 percent for the quarter, its fifth straight positive quarter since 2015.

Information technology was the best performing stock sector in the S&P in the third quarter, up 8.3 percent in a fifth-straight quarter of gains. Consumer staples was the only sector to fall in the third quarter.

The S&P and Dow rose about 2 percent in September, while the Nasdaq gained about 1 percent for the month.

"The SPX has broken out of its consolidation phase, generating a bullish "pop" in the daily stochastics," BTIG Chief Technical Strategist Katie Stockton said in a Friday morning note. "This supports near-term positive follow-through, and suggests it will take at least a couple of weeks before 'overly bullish' sentiment gives way to a pullback."

"Importantly, the Russell 2000 Index has confirmed a breakout above final resistance at its July high, reflecting the expanding breadth behind the rally," she said.

Several major biotech stocks fell after the U.S. Food and Drug Administration made it easier for the public to search for drug side effects through a database.

The CBOE Volatility Index (.VIX), widely considered the best gauge of fear in the market, traded lower near 9.5.