Internet service provider PSINet Inc. agreed to purchase Transaction Network Services Inc. for $720 million in cash and stock, one of the largest mergers ever forged by two Washington area technology companies.

The deal would unite two of the signature tech firms in the area, both of which were founded within the past decade. It also bucks a trend of local high-tech companies getting snapped up by large buyers from outside the region, a recent phenomenon that has cost Washington's flourishing high-tech sector some of its home-grown gems.

Under the terms of the deal, PSINet is to pay $351 million in cash and up to 7.8 million of its shares to TNS stockholders. That comes to about $45 a share, or a 31 percent premium over Friday's closing stock price. Transaction Network shareholders would have a choice of receiving cash, stock or some combination of both.

The acquisition, subject to shareholder and regulatory approval, is expected to close by the end of this year, said PSINet chief executive William L. Schrader. He said TNS would operate as a wholly owned subsidiary of PSINet and no layoffs are planned.

Transaction Network operates data networks that permit the validation of credit and debit card purchases and bank-teller transactions. Recently, it has begun focusing on Internet commerce, and the purchase would allow PSINet to bolster services to the growing number of businesses that buy and sell online.

"We can think of ourselves as a one-stop shop for entrepreneurs who are attempting to build an e-commerce business," Schrader said in an interview.

The combined company would employ 2,800 people and is projected to bring in close to $1 billion in annual revenue next year, PSINet said.

Transaction Network had almost sold itself last October after it reached a tentative agreement with GTech Holdings Corp., a Rhode Island firm that provides technology services to lottery operators. The deal, worth about $444 million, was scuttled when GTech failed to secure the necessary financing, a fortuitous turn for TNS given that it eventually sold for about 62 percent more.

While TNS and PSINet are within a half-mile of each other in Reston and Herndon, respectively, Schrader and his TNS counterpart, John McDonnell Jr., were barely acquainted until June. That's when PSINet approached TNS about a potential acquisition.

In an interview yesterday, McDonnell, 61, said he was not actively shopping the firm he began in 1990 in an abandoned Herndon office suite. But his initial June "dance" with PSINet resumed in earnest late last week. PSINet made a formal offer to TNS at 7 p.m. Thursday night, McDonnell said.

On Friday, McDonnell was forced to cancel a scheduled meeting with analysts in New York, an uncharacteristic move that spurred rumors of an impending deal on Wall Street. Shares of TNS catapulted $6.06 1/4, to $34.25, on Friday.

The two companies continued their discussions over the weekend. "Everyone was calling in from vacation," Schrader said. News of the agreement was first reported in yesterday's Wall Street Journal.

"They searched the world over for a strategic partner, and it turned out the best-looking girl at the dance was right around the corner," McDonnell said at a news conference.

McDonnell, who would continue as an executive in the combined operation, said he plans to stay on for the remaining 3 1/2 years of his contract.

Analysts praised the move for both firms, saying the combination would provide a broad array of services to clients bent on establishing electronic businesses, from back office to "point of sale" tools.

"It's a very strong matchup," said Riyad Said, an analyst at Friedman, Billings, Ramsey Group Inc. in Arlington. He said TNS was far better positioned today than it was in October, the time of the GTech discussions. Given its recent emphasis on electronic-commerce payment tools, and the strong increase in Internet business TNS was in a "much broader situation than before," Said noted.

"The potential for [PSINet-TNS] with small and mid-sized businesses is very substantial," said Frank Murphy, an analyst at First Union Capital Markets in Richmond.

TNS's stock soared $9 share, or 26 percent, to $43.25 yesterday. PSINet rose 31 1/4 cents, to $45.87 1/2.

CAPTION: TWO BIG JOLTS (This chart was not available)