BOSTON (AP) _ Nebraska investor Warren E. Buffett has come calling on the takeover battle-weary Gillette Co., playing the role of squire to the twice-targeted razor company.

Buffett, nicknamed the ''Oracle of Omaha'' for his canny investments and forthright business advice, has a reputation for taking sizable stakes in a limited number of companies and holding them, sometimes for years. Analysts hailed the move as a chance for Gillette to recover from its costly battles against two hostile bids in three years.

''It's a masterstroke,'' Harry Wells, who follows Gillette for the Boston investment firm of Adams Harkness & Hill, said Friday. ''One of the things that this does is totally take Gillette out of play.''

''It obviously can reduce their nervousness a bit,'' said Brenda Lee Landry of Morgan Stanley & Co. in New York.

''Essentially, I think it will give investors some confidence,'' Landry added. ''They've sort of got Buffett's blessing.''

Gillette announced Thursday that Buffett, chairman of Omaha, Neb.-based Berkshire Hathaway Inc., had purchased $600 million of Gillette preferred stock convertible into an 11 percent stake in the company and had taken a seat on the Gillette board of directors.

''His record as an astute long-term investor is widely recognized, and his investment in Gillette is a highly favorable development for the company, its stockholders and employees,'' said Gillette chairman Colman M. Mockler Jr.

Buffett was traveling Friday and could not immediately be reached at his office in Omaha.

On Thursday, he issued a prepared statement saying Gillette is ''synonymous with highly successful, international consumer marketing and is exactly the sort of business in which we like to invest for the long term.''

Despite Buffett's good reputation, analysts said they don't perceive him as a perennial ''white squire,'' or friendly investor, riding to the aid of besieged companies.

''Well, to be sure, he's not altruistic,'' Wells said. ''He's making a good investment.''

Berkshire Hathaway is a $6 billion conglomerate with interests including an encyclopedia publisher, a candy maker, an Omaha furniture mart and investments in Coca Cola Co., Capital Cities-ABC Inc. and Salomon Brothers.

The 57-year-old investor, known for the pithy annual reports he writes himself, sent a 21-page letter to shareholders this year that said Berkshire's management team gained $569 million in net worth in 1988, contributing to an average net worth gain of 23 percent over the last 24 years.

His interests include 6.3 percent of Coca-Cola, worth about $1.15 billion. In September 1987, Salomon disclosed it had sold a 12 percent stake to Buffett, preventing corporate investor Ronald O. Perelman from acquiring the stock.

Gillette has successfully fought off two hostile takeover bids in the last three years, but each time at a substantial cost. The company undertook a major restructuring after turning down a $4.12 billion Revlon Group Inc. buyout offer in November 1986.

In August 1988, Gillette repurchased 15.6 million shares to head off an attempted takeover by Coniston Partners of New York. Coniston agreed not to pursue Gillette for 10 years.

Coniston general partner Paul Tierney Jr. had little comment on the Buffett purchase.

''I wish Warren Buffett the very best. We have no longer any investment in Gillette,'' Tierney said.