Investors in U.S.-based funds poured $36.5 billion into stock funds in the latest weekly period, marking the biggest inflows on record as U.S. stocks surged to record highs, data from Thomson Reuters Lipper service showed on Friday.

The massive cash commitments for the week ended Dec. 24 were the biggest since Lipper's records began in 1992. Investors pledged entirely to funds that specialize in U.S. stocks, which attracted $39 billion, while funds that invest in non-U.S. shares posted $2.5 billion in outflows.

The demand came from both retail and institutional investors, with stock mutual funds attracting $12.8 billion and stock exchange-traded funds attracting $23.7 billion. Mutual funds are commonly purchased by retail investors, while exchange-traded funds, or ETFs, are thought to represent the behavior of institutional investors.

The inflows into stock mutual funds were the biggest since March 2000, while the inflows into stock ETFs were the biggest since March 2008. The overall inflows into stock funds follows $17.9 billion in withdrawals the prior week, which were the biggest since February.

Funds that specialize in energy stocks attracted $1.5 billion, their biggest inflows since September 2008, while funds that specialize in Japanese stocks posted $1.5 billion in outflows, their biggest on record.

Read MorePoor performance catching up with active stock fund managers



Taxable bond funds attracted $6.1 billion, their biggest inflows in seven weeks but just a fraction of the inflows into riskier stock funds. Funds that hold investment-grade corporate bonds attracted $2.6 billion after posting $80 million in outflows the prior week, which marked their first outflows since June.

Funds that specialize in emerging market shares posted $990 million in outflows, their biggest withdrawals in 10 weeks. Low-risk money market funds, meanwhile, attracted $17 billion, their biggest inflows in three weeks.

The inflows into stock funds came as the benchmark S&P 500 stock index rallied 3.4 percent and hit record closing highs on an unexpectedly strong report on U.S. economic growth and on the back of reassuring comments by the Federal Reserve on monetary policy. Year-end buying also boosted U.S. shares.