* S&P 500 tech sector breaks record held since March 2000
* Morgan Stanley rises as profit beats expectations
* CSX forecast miss drags rail stocks lower
* Dow up 0.31 pct, S&P 500 up 0.54 pct, Nasdaq up 0.64 pct (Updates to close)
NEW YORK, July 19 (Reuters) - The major U.S. stock indexes closed at record highs on Wednesday helped partly by technology stocks, which surpassed a long-standing mark, despite gains on the Dow being capped by a sharp drop in IBM shares.
The S&P 500 tech sector broke its previous record closing high that had held since March 2000 in the midst of the dot-com and Y2K tech stocks bubble. It has been the best-performing sector this year with a 22.8 percent advance.
Vertex jumped as much as 26.4 percent to an all-time high of $167, a day after it reported positive results for its cystic fibrosis treatment. The stock ended up 20.8 percent at $159.69, and was the biggest boost on the S&P and the Nasdaq.
IBM was a drag on the Dow industrials after its quarterly revenue came in below expectations and the stock fell 4.2 percent to $147.53, having hit a 13-month low of $146.71.
The Atlanta Federal Reserve raised its second-quarter GDP estimate by one-tenth of a percentage point to a 2.5 percent annualized rate after data showed U.S. homebuilding surged to a four-month high in June. The economy grew at a 1.4 percent pace in the first quarter.
"Markets are focused on fundamentals, and earnings and the economy are underpinning equities," said Quincy Krosby, chief market strategist at Prudential Financial in Newark, New Jersey.
The Dow Jones Industrial Average rose 66.02 points, or 0.31 percent, to 21,640.75, the S&P 500 gained 13.22 points, or 0.54 percent, to 2,473.83 and the Nasdaq Composite added 40.74 points, or 0.64 percent, to 6,385.04.
The Dow, S&P, Nasdaq and the small-cap Russell 2000 indexes all set record closing highs.
Analysts estimate an 8.7 percent rise in second-quarter earnings and a 4.6 percent increase in revenue for the S&P 500 companies from a year earlier, according to Thomson Reuters I/B/E/S.
Morgan Stanley rose 3.3 percent to $46.62 after the Wall Street bank reported better-than-expected profit and bond trading revenue declines that were modest compared with arch-rival Goldman Sachs'. The KBW bank index fell 0.4 percent.
Bank earnings "have come out pretty well, but apparently not enough for investors to keep them running, to keep the prices up," said Giri Cherukuri, head trader at OakBrook Investments LLC, which oversees $1.3 billion in Lisle, Illinois.
"People were expecting good earnings, and people were expecting the (Federal Reserve) to raise rates, which would be good for the stocks. A lot of the expectations were built in already. It was tough to go further."
CSX fell 5.1 percent to $51.87 after the railroad operator's forecast missed expectations, and it dragged stocks of its peers lower. Union Pacific fell 1.3 percent, while Kansas City Southern dropped 0.6 percent.
The transport sector was also hit by declines in airlines as United Continental Holdings fell 5.9 percent to $74.24, a day after it forecast "disappointing" passenger unit revenue for the third quarter.
Advancing issues outnumbered declining ones on the NYSE by a 2.95-to-1 ratio. On Nasdaq, a 2.04-to-1 ratio favored advancers.
About 5.78 billion shares changed hands on U.S. exchanges, compared with the 6.41 billion daily average over the past 20 sessions.
(Reporting by Rodrigo Campos and Kimberly Chin; Editing by Nick Zieminski and Peter Cooney)