The Soviet Union maintained official silence today following Somalia's decision yesterday to renounce its a friendship treaty with Moscow and expel several thousand Soviet military and technical advisers.

The break between the Soviet Union and its former principal ally in the Horn of Africa - a strategic segment of the continent in the northeast that commands approached to the oil-rich Persian Gulf states - has been brewing ever since the Kremlin began backing Somalia's neigbor and territorial enemy, Ethiopia, some months ago.

Western sources have estimated that about 4,000 Soviet technical and military advisers were in Somalia, which signed the friendship treaty in 1974 when Nielai Pedgroy then the soviet president was in Mogadishu. It was the first treaty reached by the Kremlin with any African state south of the Sahara desert and marked a high-water mark for Soviet influence on the continent.

Moscow presently has friendship treaties with Angola and Mozambique that bring economic and military aid to the two states. An earlier friendship agreement with Egypt was renounced by Cairo.

Strains in the Soviet-Somali relationship heightened this summer when Somali-backed guerrillas pushed into the barren Ogaden region of Ethiopia in a territorial war that has tribal and historic roots. At the time, the Kremlin had begun backing Ethiopia and was supplying both nations with arms. Soon, the Soviets were trying to persuade the Somalis to withdraw. While refraining from criticizing Mogadishu, the Kremlin officially condemned "attempts to change frontiers in Africa by force."

Moscow apparently decided some months ago to back Ethiopia in the fight and risk a break with Somalia. The Somali announcement apparently means that Moscow will lose access to its newly built naval base at Berbera on the Gulf of Aden. This base provided access to shipping lanes from the Red Sea northeast into the Persian Gulf and allowed the Soviets to service their growing Indian Ocean fleet through the Gulf of Aden.

The direction of Kremlin policy began to emerge early this fall, when Somali President Mohamed Siad Barre arrived here in unusual secrecy to discuss Soviet pressure for an end to Somalia's fight against Ethiopia. At the time the Somali forces were easily sweeping the Ethiopians before them.

The war has since settled into one of generally static boundaries, with the Somalis claiming nearly all of the Ogaden. The Siad Barre trip to Moscow resolved nothing and Soviet leader Leonid Brezhnev did not even see the Somali leader.