Stocks gave up early gains and closed lower as optimism about second-quarter earnings gave way to profit-taking from last week's stunning rally.

The Dow Jones industrial average fell 4.12, to 11,135.12. During the session, the blue-chip index rose more than 97 points above Friday's record close of 11,139.24. That record capped a week in which the Dow advanced 586.68 points.

Broader stock indicators also ended lower today after a late sell-off. The Standard & Poor's 500 index fell 3.10, to 1388.12, and the Nasdaq composite index fell 4.24, to 2736.78.

Stocks faltered as weakness in the bond market and a desire to lock in profits outweighed the strong outlook for second-quarter earnings.

The price of the 30-year Treasury bond slipped $4.06 per $1,000 in face value, pushing the yield to 6.03 percent, up from 6 percent late Friday. Traders consider bond yields above 6 percent a threat to stocks, in part because at that level they present a more attractive alternative.

Christine Callies, chief investment strategist at Credit Suisse First Boston, said the higher interest rates implemented by the Federal Reserve last Wednesday set the stage for a market drop.

With interest rates set for now, analysts said investors have turned their focus to corporate earnings. Initially, rosy forecasts attracted buyers today, but analysts said some traders ultimately decided to sell, perhaps worrying that results will miss the mounting expectations of Wall Street.

Yahoo rose strongly for much of the session in advance of its second-quarter earnings report, due Wednesday. But the Internet search company faltered in late afternoon, ending down 3 1/8 at 175 on the Nasdaq.

Favorable reports on Intel fed excitement in the Nasdaq market. Analysts at Merrill Lynch and Prudential Securities raised their ratings on Intel stock, saying the chipmaker is successfully managing stiff price competition. Intel rose 5/16, to 63-13/16, though it pared early gains.

Several Internet companies rose on announcements of new ventures. AOL, up 5-11/16 at 120-15/16, and, up 13 1/4 at 36 7/8, both got a boost from a deal that makes the primary provider of health information to AOL users.

Oil stocks were mostly higher as the price of crude oil briefly topped $20 a barrel for the first time since November 1997. Chevron, a Dow component, rose 2-1/16, to 98-5/16. TotalFina SA's unsolicited takeover bid for Elf Aquitaine also helped boost the sector, as Elf soared 16-1/16, to 90 3/8.

Ralph Acampora, Prudential's famously bullish technical analyst, said in a research note today that the Dow could hit 13,000 during 1999. Acampora's most conservative estimate for the year is in the range of 12,000 to 12,300.