Funds that focus on U.S. stocks charged to record highs in the third quarter as companies' tax-cut-fueled profits gains surpassed even upsized expectations.

The U.S. economy also hit its fastest growth rate in nearly four years, and S&P 500 index funds are on track for their best quarter in nearly five years.

Foreign stock funds’ had modest gains or were down, restrained by worries about a trade war and slower economic growth. Bond funds struggled in the face of rising interest rates.

Analysts had lofty expectations heading into the second-quarter earnings season, forecasting profit growth of about 18 percent for S&P 500 companies. Actual profit growth ended up being 25 percent, according to FactSet.

The gains were across the board for S&P 500 index companies; and that helped vault all types of U.S stock funds to records, whether they focus on big companies or small and the health care sector or financials.

While the performance has been solid, after such an extended climb some fund managers are urging caution, or at least lowered expectations.

“Things feel good now,” said Matthew McLennan, head of global value at First Eagle Investment Management. But the big moves for stocks in recent years mean they’re more expensive than usual, relative to their profits, and the big buildup of government indebtedness around the world is raising risks.

“Now is the time to be preparing yourself for a more difficult environment,” said McLennan, who helps run the $54.7 billion First Eagle Global fund.

The U.S. economy continues to show strength, with the final reading on second-quarter GDP, released Thursday, showing the economy advanced at 4.2 percent annual clip. There is some anticipation that growth may moderate in the third quarter due to a widening trade gap, but an increase in inventories may offset.

Third-quarter earnings season will soon kick off.

The Associated Press contributed to this report