The Soviet Union, ending a long silence about the exact number of its casualties in the war in Afghanistan, said today that 13,310 soldiers had been killed, 35,478 wounded and 311 are missing.

At the same time, the Government said continued aid by Pakistan to the Afghan guerrillas was unacceptable now that Soviet troops have begun to return home, and warned that Moscow might reconsider its options if the assistance does not stop.

The number of troops killed was slightly higher than the United States had estimated. Washington had put the number of Soviet casualties in the eight and a half years of war at 33,000 to 38,000, a third of them fatalities.

Moscow has never made public the number of Soviet troops in Afghanistan, and officials again declined to do so today. The United States has estimated that the number has been about 115,000 since Soviet forces entered Afghanistan in late 1979. Losses Are 'Quite Heavy'