CAMBRIDGE, Mass. - Wars that have raged for years are ending. The Reagan administration has been quick to argue that this results from its policy of strength. Actually, the peace epidemic tells a great deal about the sharp limits the international system puts on the successful use of force.Critical to the success in ending wars - in Afghanistan, Cambodia, the Western Sahara, Namibia and between Iran and Iraq - has been the political cooperation of the superpowers as well as an active role for international or regional organizations.

One factor common to all the cases is exhaustion - the exhaustion of all, or of a side that is incapable of reaching its goal and is resigned to a face-saving agreement to cover retreat.

The first case is that of Iran and Iraq. Iraq, the initial aggressor, broke all the Iranian offensives but lacked the strength to reach its territorial and ideological goals. Iran contained Iraq but was bled white by its determination to pursue the war until the Iraqi regime was destroyed.

General exhaustion has also been the key factor in southern Africa. Pretoria's increasing losses to Cuban offensives in southern Angola led it to reconsider its stand on Namibia.

In Afghanistan and Cambodia, invaders learned a key lesson: National liberation forces, given adequate internal and external support, can prevent an invader from controlling the countryside and can inflict losses that gradually appear unbearable and deny victory at a tolerable price.

In Afghanistan, a Soviet triumph would have required a far greater involvement of Soviet forces and even greater devastation at even higher costs in international prestige - and perhaps a risky attack on Pakistan, America's ally.

In Cambodia, a Vietnamese triumph would have required an invasion of Thailand, main base of Cambodian guerrillas.

The exhaustion of one or both sides often has to be engineered from outside. Iran not only ran out of volunteers but of externally supplied equipment; Iraq was pressured by its supporters into accepting a truce.

Also decisive has been the Kremlin's decision to distinguish between its principal and secondary interests abroad and to reduce its burden in international affairs.

Another important factor is a kind of collusion between Mikhail S. Gorbachev and the Reagan Administration. Both seem to have discovered that the Third World is an unrewarding terrain for competition: a trap, not a prize.

Both Moscow and Washington had an interest in allowing neither Iran nor Iraq to win their war, while not decisively antagonizing either side.

Further, America has pressed Pretoria to settle now rather than wait for a later moment when American hostility to apartheid might be more intense.

In Cambodia, the administration is trying to shift power within the resistance from Pol Pot to the unsinkable Prince Norodom Sihanouk. Here, Soviet-American cooperation is not enough: A settlement requires a greater willingness by China to drop its support for Pol Pot.

Finally, the United Nations Secretary General and his associates have helped arrange settlements in a way that saves face for the belligerents. These efforts have been particularly evident in Afghanistan, the Iran-Iraq war and the Western Sahara.

In organizing a referendum in the Western Sahara and in leading Namibia to independence, the United Nations will have an important political role to play as well.

It is ironic that the revival of the United Nations has occurred under the Reagan administration, the most hostile of American postwar governments to international and regional institutions.