Norfolk & Western Railway of Roanoke announced yesterday that it plans to boost its ownership of Piedmont Aviation Inc. to as much as 20 percent of the air carrier's common stock, subject to approval by the Civil Aeronautics Board and Piedmont directors.

If the big freight transportation firm's planned investment is approved, it will be the first time an American railroad has had a substantial airline holding. Piedmont Aviation owns Piedmont Airlines, one of the nation's most successful and profitable regional air carriers. N&W also is planning a merger with Washington-based Southern Railway.

Under an agreement in principle, N&W said it will buy 1.2 million new shares of Piedmont stock for $38.4 million. N&W purchased 650,000 Piedmont shares on the open market last summer for $18.25 million and suggested merger talks, which Piedmont executives turned down.

Yesterday, however, the two firms announced a formal agreement under which the rail company can buy additional shares at $32 apiece but must refrain from acquiring more than 20 percent overall for the next five years. The earlier stock purchases were completed when Piedmont stock was trading at less than $30 a share.

Ownership of one-fifth of the airline's stock amounts to a controlling interest in Piedmont and represents a major shift in policy for the air carrier's executives, who thwarted proposed merger or takeover bids by airline companies in the past year. "It is in the best interest of our company and our stockholders to remain independent," Piedmont said in September when N&W's initial investment was revealed.

N&W became the largest single Piedmont stockholder with its purchases last summer. Morgan Guaranty Trust Co., a large New York bank, owns 5 percent of Piedmont stock. The bank was the only owner of 5 percent or more of the stock on Jan. 31.

In September, N&W said it did not intend at that time to propose a merger or other form of business combination with Piedmont, based in Winston-Salem, N.C., and the second-biggest user of Washington's National Airport. The CAB must approve purchases of 10 percent or more of the shares in an aviation company, an investment level considered to be one of control by the regulatory agency.

Final terms and conditions of the plan will be revealed later, according to the announcement by N&W President Robert B. Claytor and Piedmont Chairman Thomas H. Davis.

N&W is a cash-rich railroad with working capital of more than $240 million, and Claytor, who became N&W president Oct. 1, has advocated diversification of the railroad.

At a time when other railroads were selling tax benefits in complicated lease arrangements permitted under the 1981 tax act, N&W recently paid more than $40 million for the benefits of two unidentified companies. The benefits will apply to more than $200 million worth of equipment owned by the companies.