Poland and the Soviet Union signed a five-year economic agreement here today that calls for growing dependence by Poland on Soviet trade and investments as it seeks to revitalize its ailing economy.

Under the protocol, concluded after several months of talks, Moscow's share of total Polish trade is due to rise to 40 percent by 1990, a slight increase over its current level of 37 percent. Poland is to expand imports of Soviet machinery in place of western products and Polish firms are to participate in new joint production schemes with Soviet enterprises.

The agreement, part of a regular process of coordination of five-year economic plans among East Bloc countries, reflected Poland's relatively moderate response to increasing Soviet pressures on its allies to expand economic ties at the expense of contacts with the West, economic analysts here said.

Most East European countries recently have expanded their bilateral trade with the Soviet Union even beyond the paying of higher prices for imports of Soviet raw materials. Poland and several other nations have also been under pressure to reduce large trade deficits with the Soviets and increase the quality of the manufactured goods they sell to communist partners.

The Polish-Soviet agreement appears to allow the government of Gen. Wojceich Jaruzelski some flexibility in meeting the Soviet terms at a time when it is also under pressure to repay large debts to western creditors. The protocol calls for Poland to continue to borrow rubles to pay for Soviet imports for two more years. Payment of outstanding debts of nearly $7 billion is to be delayed until after 1990.