Updated from 4:04 p.m. EDT

Stocks endured a choppy session Wednesday, but the major averages closed near their highs thanks to a late-day rumor that software giant Microsoft ( MSFT) is preparing to lift its guidance.

The Dow Jones Industrial Average finished with a gain of 100.45 points, or 1.1%, to 9617.71. The Nasdaq was up 21.94 points, or 1.5%, to 1519.12, and the S&P 500 rose 6.66 points, or 0.7%, to 1020.26.

The major averages bounced from positive to negative territory throughout the session before the Microsoft rumor led stocks solidly higher. Before that speculation started spreading, investors were torn between the good news of Motorola's quarterly affirmation and the troubling reports of more possible impropriety by a top-level corporate executive.

The biggest story of the day surrounded former ImClone ( IMCL) CEO Sam Waksal, who was arrested for insider trading violations and later released on $10 million bail. ImClone is fighting allegations that it misled shareholders about the prospects of its experimental cancer drug Erbitux. The news of Waksal's arrest sent the stock as low as $6.85 before it eventually recovered to close up 3.7% to $7.83.

Elsewhere, a big merger was brewing among two media companies that target the Spanish-language market. Television network Univision Communications announced plans to acquire radio broadcaster Hispanic Broadcasting ( HSP) for $3.5 billion in stock.

Under the terms of the deal, Univision will off 0.85 shares of its common stock in exchange for each Hispanic Broadcasting share, a 26% premium. Hispanic Broadcasting shares rose late Tuesday when word of the deal leaked in the market. Hispanic rose 6% to $26, and Univision fell 15% to $31.86.

Several companies were coming out with profit forecasts, and the outlooks were mixed. Consumer products maker Procter & Gamble ( PG) raised its fourth-quarter guidance, saying it expects earnings to exceed analysts' expectations thanks to increased sales overseas and strong sales volume. P&G was up 4% to $93.

Another upside surprise came from appliance maker Maytag , which said increased sales and margins for its washing machines and other items would lift earnings above the consensus estimate. Maytag jumped 7% to $45.26 on the rosy forecast.

Motorola was doing what it could to lift the spirits of technology investors, saying that second-quarter sales would meet or beat its expectation of about $6.4 billion. Motorola climbed almost 9% to $15.66, but several tech names remained under pressure because of the discouraging announcements that keep coming out of the sector.

After the close Tuesday, Siebel Systems Chief Financial Officer Ken Goldman said the current quarter is shaping up to be as challenging as the first. Chief Executive Tom Siebel previously characterized the first quarter as the worst in the software industry's history. The stock gave up 14% to $15.18.

Separately, Juniper Networks ( JNPR) shed 1% to $7.21. The company said at an event in Hong Kong that the business climate remains challenging and that it doesn't see any signs of a recovery in the near term. Subsequently, Morgan Stanley lowered its investment rating on the stock to underweight from equal-weight.

Internet incubator CMGI , once one of the kings of the New Economy, posted a quarterly loss and lowered its revenue target for the full year. The company's shares slid 10% to 56 cents.

Another disappointment was Monsanto ( MON), a maker of agricultural products, which lowered its second-quarter and full-year guidance, citing economic uncertainties in Latin America. The stock fell 5% to $25.55.

Countering the shortfall preannouncements, Jabil Circuit ( JBL), Veritas Software ( VRTS) and Vitesse Semiconductor ( VTSS) were reaffirming their prior forecasts.

Several firms, including Morgan Stanley and Salomon Smith Barney, trimmed their estimates on cell-phone maker Nokia ( NOK) a day after the company lowered its second-quarter sales guidance. Nokia added 1% to $12.68.

The only significant item on the economic docket was the Federal Reserve's anecdotal survey known as the Beige Book. The report showed that economic growth was uneven in April and May, the job market was stagnant and retail sales were flat.

U.S. Treasuries were moving higher around 4 p.m. EDT. The 10-year note up 3/32 to 99 11/32, yielding 4.96%. Shorter-term notes and the long bond were also gaining ground.

European markets were weaker. London's FTSE 100 was down 1.7% to 4852, while Germany's Xetra DAX fell 2.1% to 4510. In Asia, Japan's Nikkei 225 fell 1.1% to 11,327, and Hong Kong's Hang Seng closed down 0.6% to 11,148.