How close can a plane fly to another aircraft?

Commercial aircraft flying below 29,000 feet must maintain a vertical separation of 1000 feet. Any higher and the separation increases to 2000 feet, except in airspace where Reduced Vertical Separation Minimum applies.

In that case, required separation is also 1000 feet at altitudes between 29,000 feet and 41,000 feet, which is where a commercial aircraft operating in cruise mode is likely to be. Europe, North America, parts of Asia and Africa and both the Pacific and Atlantic oceans fall within RVSM airspace.

Flying in the crowded skies of Europe or North America, it's quite common to see other aircraft whizzing past, either above or below. Before  the introduction of RVSM, the required vertical separation was 2000 feet.  

RVSM was introduced between 1997 and 2008, when improved accuracy in instrumentation allowed aircraft to maintain an exact cruising altitude. RVSM also allows aircraft to safely fly more optimum routes  and to benefit from fuel savings. It also increases airspace capacity.

Since aircraft cause wake turbulence that may affect other aircraft flying the same track at the same altitude, horizontal separation is much greater than vertical. In controlled airspace, the required minimum horizontal separation between aircraft flying at the same altitude is five nautical miles, just over  9 kilometres. In terminal area airspace, horizontal separation decreases to three nautical miles.

When they fly in airspace which is not monitored by radar or satellite-based navigation, aircraft are separated according to procedural rules based on radio reports from pilots.