Procter & Gamble Co. said yesterday it has agreed to acquire Richardson-Vicks Inc. in a friendly $1.2 billion merger designed to thwart Unilever N.V.'s hostile takeover bid for Vicks.

P&G said it will begin a $69-a-share cash tender offer for Vicks as soon as possible. The Cincinnati-based purveyor of products ranging from Ivory soap to Duncan Hines cake mixes is offering Vicks shareholders a premium price; Vicks stock has traded as low as 26 5/8 in the last year and opened yesterday at 63 1/2, after jumping 10 points on Monday.

The merger agreement is the second billion-dollar deal combining consumer products companies to be announced in recent days. Philip Morris Cos. Inc., the giant cigarette manufacturer, said last Friday that it has agreed to acquire General Foods Corp. for more than $5.6 billion, a merger that would create the nation's biggest consumer products company.

For P&G, the acquisition of Vicks would give it a major stake in the worldwide marketing of personal-care products. Vicks, which has a strong presence outside the United States, markets well-known products including Vicks Formula 44, Nyquil, Vicks cough drops, Vap-O-Rub and Oil of Olay.

"We are confident this will enhance P&G's position as worldwide leader in health and personal-care products," said P&G President John G. Smale, who used to work at Vicks. "Richardson-Vicks will operate as a wholly owned subsidiary and will maintain its headquarters in Wilton, Conn."

"The board of directors fought a hard battle to preserve the interests of all shareholders, and this has now been done," said Vicks Chairman Stuart Smith Richardson. "P&G is an ideal merger partner for Richardson-Vicks because of our common dedication to the quality of our products and the treatment of our employes," added Vicks President John S. Scott.

Vicks and P&G entered into several agreements yesterday that will make it difficult for Unilever or any other bidder to derail the planned merger. Vicks granted P&G a "crown jewel option" to buy its most valuable business, Oil of Olay, a maneuver designed to diminish Vicks' attractiveness to other suitors.

Richardson family members, who control about a third of Vicks' shares, entered into a separate agreement to sell their stock to P&G. When the family's shares are combined with another option to purchase 4.4 million shares that P&G was granted, P&G would control 48.9 percent of Vicks outstanding shares.

Vicks, which had sales of $1.2 billion and net income of $72.2 million last year, has vigorously opposed Unilever's attempts to acquire the company. Vicks officials have said that Unilever violated a promise that it would only proceed with a takeover bid that had the support of the Vicks board.

However, once Vicks rejected the Dutch company's initial $56-a-share offer last month, Unilever increased the pressure on the Vicks board to sell by bidding $60 a share if the Vicks board supported its offer and only $48 a share if the board rejected its proposal.

P&G, which had sales of $12.9 billion and net income of $890 million last year, entered the personal health products field in 1982 by acquiring Norwich-Eaton, which makes Pepto Bismol. However, the acquisition has not given P&G the presence it desires in the cold-remedy products business, where Vicks is a leader.

If P&G completes the Vicks deal, the company would have more than $14 billion in annual revenue, making it the third-biggest consumer products company in the nation. Earlier this year, R. J. Reynolds Industries Inc. acquired Nabisco Brands Inc., creating what will be the nation's biggest consumer products company, with more than $18 billion in annual sales, until the Philip Morris-General Foods merger takes place.

A spokesman for Unilever said the company had no comment.