By Caitlin McCabe and Anna Isaac

U.S. stocks rallied Monday after a choppy morning session as investors continued to put faith in signs of a nascent economic recovery, despite a rise in coronavirus-infection rates in some states.

All three major indexes traded solidly higher in the afternoon after wavering throughout the morning. The Dow Jones Industrial Average, as of 4 p.m. ET, rose 152 points, or 0.6%. The S&P 500 added 0.7%, while the Nasdaq Composite rallied 1.1%, driven by gains among large-cap technology stocks.

Stocks are attempting to extend last week's rally, during which all three indexes ended the week up 1% or more. However, looming uncertainties surrounding the coronavirus pandemic, relations between U.S. and China and the November election have begun to weigh more heavily on investors. Data shows that infections have picked up pace in Arizona, South Carolina, Florida and Texas.

Those concerns have helped push gold prices to multiyear highs and started to mute this month's performance in stocks, despite strong gains at the beginning of June. Earlier this month, technical measures flashed some bullish signals as a wider-ranging group of stocks began rising in lockstep, suggesting that stocks may have more room to run in the months ahead. The wider gains also helped major indexes erase most of their losses for the year. The S&P 500 is down just 3.5% year-to-date.

Nevertheless, indexes have been moving in more of a narrow pattern in recent days as investors try to determine what may happen in the coming month. Monday's gains, however, could help stocks break out of the range.

"I would say we're in no man's land right now," said Nate Fischer, chief investment strategist at Strategic Wealth Partners. "I think to consolidate and move sideways is the best thing for the market. To have it take its breath and digest market events that really matter."

Traders have faced a dizzying amount of information lately, and murky corporate guidance has made it difficult to determine the path ahead. As a result, some have been looking to a number of unconventional metrics, such as restaurant reservations and airline travel figures.

Economic indicators have also been mixed. A strong pickup in retail sales, as well as signs that jobless claims are easing, have offered traders confidence that economic activity is picking up after weeks of widespread shutdowns.

Yet there are still signs that the recovery has a long way to go, and on Monday, fresh data showed that sales of previously owned homes dropped 9.7% in May from the prior month, as the coronavirus pandemic prevented shoppers from taking advantage of the typically busy spring homebuying season. Economists surveyed by The Wall Street Journal expected an 8.8% decline.

Some of Monday's gains were driven by a continued rally in big technology stocks, which have largely led the markets off their March lows. Utilities stocks also rallied, as did shares of some retailers and restaurants. Microsoft gained 2.4%, and Dominion Energy rose 2%. Additionally, Gap surged 8.9%, while Chipotle Mexican Grill rallied 4.9%.

Still, there big losses, too. American Airlines fell 7.2% after the U.S. carrier said Sunday that it plans to raise $3.5 billion in debt and equity to boost its liquidity and help maintain operations through the pandemic. Royal Caribbean Cruises also stumbled, losing 7.3%, while Wynn Resorts shed 4.1%.

Part of the market's turbulence lately has been driven by a split between bullish and bearish sentiment within the investment community, said Shawn Snyder, head of investment strategy at Citi Personal Wealth Management.

"You have this situation where you have retail investors that have come into the market and they have an extremely bullish view...and institutional investors who are having a bit of a more cautious view," Mr. Snyder said. "You have these two camps that are trying decipher which view is right."

Uncertainty surrounding coronavirus infections has contributed to some of investors' bearish sentiment, as it remains unclear if rising infections could slow re-openings of businesses in some states. On Sunday, White House trade adviser Peter Navarro said that the Trump administration is " filling the stockpile in anticipation of a possible problem in the fall." In a statement later, Mr. Navarro said that the administration doesn't "necessarily expect a second wave but prudence dictates that" the White House plans for it.

Outside of the stock market, gold prices rallied, with front-month gold futures hitting their highest close since October 2012, according to Dow Jones Market Data.

And in bond markets, the yield on the 10-year U.S. Treasury ticked up to 0.704%, from 0.696% Friday. Yields rise when bond prices fall.

In Europe, oil-and-gas companies and travel and leisure stocks were among the worst performers. The pan-continental Stoxx Europe 600 lost 0.8%.

Payments company Wirecard was pummeled 44% after t he troubled German business said the $2 billion that banks were supposedly holding on its behalf probably doesn't exist.

In Asia, most major equity benchmarks dropped. Hong Kong's Hang Seng Index was among the biggest losers, down 0.5%. India's S&P BSE Sensex, meanwhile, gained 0.5%.

Write to Caitlin McCabe at caitlin.mccabe@wsj.com and Anna Isaac at anna.isaac@wsj.com