SAN FRANCISCO (MarketWatch) — Shares of Apple Inc. climbed to record levels Monday — making Apple the most valuable company ever by market capitalization — while Facebook Inc. slumped to its lowest point before bouncing back after an upgrade.

Apple shares AAPL, -0.75% gained 2.6% to close at $665.15, a record, as buzz grew around the expected September launch of the iPhone 5.

Logo outside Apple Store at New York’s Grand Central Station. Reuters

The share gains made Apple the most valuable company ever by market capitalization.

Apple closed with a market cap of $623.5 billion, up from $607.5 billion on Friday, according to data from FactSet.

The previous record was held by Microsoft Corp., according to Howard Silverblatt of S&P Dow Jones Indices, as cited by The Wall Street Journal. According to FactSet, Microsoft had a market cap of $613.3 billion in late December 1999.

But the broader tech sector kicked off the week in the red, as the Nasdaq Composite Index COMP, -0.29% shed a fraction to close at 3,076.

Shares of Facebook Inc. FB, +1.93% began the week on a downbeat note, hitting a low of $18.75, but the social-networking stock bounced back after Capstone Investments upgraded the shares to buy from hold with a price target of $26. The stock gained 5% to close at $20.01.

Charge your gadgets on the go

In a note, analyst Rory Maher cited potential “upside to the company’s core business and potential returns from new businesses the stock price currently does not give the company credit for.”

Maher added, “Over the long term we see social media carving a strong position as a media and advertising category, but don’t expect Facebook to create a new ad product, like search, that essentially redefines the online industry and steals major share from other ad categories.”

Other social-media stocks posted losses. Zynga Inc. ZNGA, +0.55% shed a fraction to close at $2.99, while Yelp Inc. YELP, -0.29% saw its shares fall 6% to close at $20.22 and Groupon GRPN, -9.42% traded down 2.1% to close at $4.65.

However, LinkedIn LNKD rose 1.5% to close at $102.92.

Groupon took a hit from a Wall Street Journal report that early investors, including Silicon Valley veteran Marc Andreessen, are giving up on the stock and heading for the exits. Read full story on share sales by some of Groupon’s pre-IPO investors.

The Morgan Stanley High Tech 35 Index MSH, +11.11% was down 0.3%, while the Philadelphia Semiconductor Index SOX, +0.21% lost 0.7%.

The tech sector was weighed down by losses in shares of Cisco Systems CSCO, -0.17% , which was off 0.6%, closing at $18.94, and Microsoft Corp. MSFT, -1.04% , which was off by 0.5%, closing at $30.74.

On the upside, the group got a lift from shares of Hewlett-Packard HPQ, +0.31% , which gained 2.9% to close at $20.09, and Dell Inc. DELL, +1.61% , which was up 2.8% to close at $12.56.

The two personal-computer firms are scheduled to report results this week.