* Microsoft gains after agreeing to buy GitHub for $7.5 bln
* Merck gains, Nektar plunges after latest cancer drug data
* Indexes gain: Dow 0.76 pct, S&P 0.42 pct, Nasdaq 0.59 pct (Changes comment, adds details, updates prices)
By Medha Singh
June 4 (Reuters) - Apple and Microsoft led a rally in technology stocks on Monday, driving U.S. stocks higher, after the iPhone maker kicked off its annual developers conference and the Windows software maker snagged a popular coding website.
Apple unveiled its latest operating system iOS 12 at the conference. Its stock gained as much as 1.7 percent, providing the biggest boost to S&P 500 and tech-heavy Nasdaq , and taking the company's valuation to about $951 billion.
"Given Apple's close proximity to a $1 trillion market capitalization, the focus on the stock performance following WWDC might be greater," BTIG analyst Walter Piecyk wrote in a note.
"Apple's stock would need to rise $12 to $202 to clear the milestone. Unfortunately, Apple has not typically demonstrated that type of performance following a WWDC."
Microsoft's shares rose about 1 percent after it announced a $7.5 billion deal to buy privately held coding website GitHub Inc.
The S&P technology index was up 0.9 percent, while the Nasdaq was only 0.6 percent away from hitting a record.
The tech boost added to the momentum from Friday's better-than expected jobs data, leading the indexes higher for the second day in a row.
"Economic data has been getting quietly better amid the sort of headline chaos," Tom Essaye, founder of investment research firm Sevens Report said.
"The market has been focusing on those fundamentals and there has been a resiliency in stocks in the past couple of weeks because of better economic data and tame inflation."
At 12:44 p.m. EDT the Dow Jones Industrial Average was up 186.25 points, or 0.76 percent, at 24,821.46, the S&P 500 was up 11.59 points, or 0.42 percent, at 2,746.21 and the Nasdaq Composite was up 44.85 points, or 0.59 percent, at 7,599.19.
Nine of the 11 main S&P indexes were trading higher.
Boeing rose 1.2 percent, the biggest boost to the Dow, after the planemaker said it would partner with French aerospace firm Safran SA to make and service aircraft parts.
Nektar Therapeutics slumped 39.2 percent and weighed on the Nasdaq biotech index after mixed results from its experimental cancer drug with Bristol-Myers Squibb's Opdivo disappointed investors.
Bristol-Myers Squibb was 4.4 percent lower.
Merck, however, gained about 1.7 percent after latest data showed its cancer drug Keytruda improved survival as a stand-alone treatment for a type of lung cancer.
Advancing issues outnumbered decliners by a 1.62-to-1 ratio on the NYSE. Advancing issues outnumbered decliners by a 1.30-to-1 ratio on the Nasdaq.
The S&P index recorded 41 new 52-week highs and five new lows, while the Nasdaq recorded 183 new highs and 34 new lows. (Reporting by Medha Singh in Bengaluru; Editing by Shounak Dasgupta)