Mutual-fund investors aren’t giddy, but they continue to buy in.

As the stock market hit records in the second quarter—a rally that has continued in July—investors sent their cash to both stock and bond funds.

Investors put a net $10.0 billion into U.S.-stock mutual funds and exchange-traded funds, and $56.7 billion into international-stock funds, based on Investment Company Institute estimates. As often happens, they invested much more—a net $161.8 billion—in bond funds, partly to protect themselves for the day when the bull market falters.

Still, even with the bond protection, investors have been willing to step in to the stock party.

“The really big notable thing in the second quarter is we continued to see a robust pace for global equity flow,” says Gargi Chaudhuri, managing director and head of investment strategy in the Americas for iShares in New York.

Ms. Chaudhuri says what she particularly noticed toward the end of the quarter was U.S. investors warming to Europe. “And I believe that makes complete sense, given that we expect the economic restart that already has started in the U.S. to move to the eurozone,” she says.

The average U.S.-stock fund rose 6.8% in the quarter, including 1.5% in June, according to Refinitiv Lipper data. That pushed the year-to-date advance to nearly 16%. International-stock funds were up 5.5% in the quarter, after being down nearly 1% in June, to push their year-to-date gain to 9.1%.

U.S. stocks have been rising since mid-May along with the economy, even though the prospect of inflation looms.

“Inflation is going to be higher than it has been in the last decade, but the Fed has all the tools to fight inflation when it gets there,” says Ms. Chaudhuri. Still, she adds, the prospect of inflation has some investors moving to allocate to commodities as well, “protecting their portfolios for an inflationary backdrop.”

Bond funds rose in the quarter. Funds tied to intermediate-maturity, investment-grade debt (the most common type of fixed-income fund) gained 1.9% in the quarter to trim the year-to-date decline to 1.1%.

Mr. Power is a Wall Street Journal news editor in South Brunswick, N.J. Email him at william.power@wsj.com.