By Gunjan Banerji and Anna Isaac

Shares of technology heavyweights dragged the S&P 500 lower Friday and toward a weekly loss, snapping a three-week winning streak.

The week has been marked by big swings among shares of individual companies and a rotation between some of the market's recent winners and losers. The information technology sector -- one of the market's biggest winners this year -- was the biggest laggard of the S&P 500's 11 sectors for the week.

The S&P 500 lost 20.03 points, or 0.6% to 3215.63. The Dow Jones Industrial Average shed 182.44 points, or 0.7%, to 26469.89. The tech-heavy Nasdaq Composite dropped 98.24 points, or 0.9% to 10363.18, finishing its second consecutive week of declines.

The S&P 500 and Dow lost 0.3% and 0.8% for the week, respectively. The Nasdaq notched a 1.3% weekly loss.

Shares of some tech heavyweights and momentum-driven stocks faltered. Facebook and Apple fell 4.7% and 3.9% this week, respectively, underperforming the broader market. Tesla, which reported an earnings beat on Wednesday, shed 5.6% this week.

Shares of Intel fell $9.81, or 16.2% Friday, to $50.59 after its earnings, the biggest single-day decline since March. The chip maker reported stronger earnings in the second quarter after Thursday's market close, but also signaled a delay to its development of superfast chips.

"The concentration of the S&P 500 among the tech names is adding to the momentum downward," said Amy Kong, chief investment officer of Barrett Asset Management. "Momentum definitely builds to the upside and it also builds to the downside."

The five largest stocks in the index -- Apple, Microsoft, Amazon.com, Google-parent Alphabet and Facebook -- recently made up about a quarter of the index, the highest proportion in at least 30 years, according to Goldman Sachs analysts.

Investors will be keeping a close eye on tech earnings releases over the next week, with Amazon.com and Alphabet reporting their financial results.

Investors flocked to these companies, which they viewed as relatively shielded from the pandemic's economic damage. If their shares falter after earnings, that poses a threat to the broader stock market given their outsize influence on the S&P 500.

Some investors said that this group's strong and extended rally meant it was bound for a pullback.

"It was due for a bit of a snap," said Giorgio Caputo, a portfolio manager at J O Hambro Capital Management.

Anxiety about the coronavirus pandemic and geopolitical tensions around the globe were evident in the market for gold and Treasurys. Gold prices surged to a new closing record for the first time since 2011 as investors sought relatively safer assets. Most actively traded gold futures, for delivery next month, advanced 0.4% to $1,897.50 a troy ounce. Meanwhile, the yield on the 10-year Treasury note fell to 0.589% Friday from 0.628% last week, falling for the third consecutive week.

Also hanging in the backdrop was rising tension between Washington and Beijing that threatens to cloud prospects for trade between the world's two largest economies.

China on Friday ordered the closure of the U.S. consulate in Chengdu, a city in the southwestern part of the nation, in a tit-for-tat retaliation against Washington's decision to shut down the Chinese consulate in Houston. The closures mark another step in the deterioration of relations between the two nations, which have clashed over trade, technology, handling of the coronavirus pandemic and global influence.

China's major stocks benchmark, the Shanghai Composite Index, fell 3.9% by the close of trading, capping off a second consecutive week of declines. Hong Kong's Hang Seng Index retreated 2.2%.

"Today's act by China is seen as an actual political retaliation, as opposed to the typical verbal scuffles that had been going on," said Ong Zi Yang, senior macro analyst at FSMOne.com in Singapore. "The escalation in geopolitical tensions has encouraged varying degrees of profit-taking among investors, especially as Chinese equities have rallied quite significantly since the global equities sell-down in March."

U.S. stocks have also been sensitive this week to cues on whether lawmakers will have a new stimulus bill hammered out before their summer break in August.

"The road toward an agreement is expected to be bumpy, so markets are taking a breather," said Geoff Yu, senior markets strategist BNY Mellon. "It's important to avoid a sense of a cliff in household expectations. That would be a problem for the U.S. and the rest of the world as well."

--

Chong Koh Ping

contributed to this article.

Write to Gunjan Banerji at Gunjan.Banerji@wsj.com and Anna Isaac at anna.isaac@wsj.com