How do fast-flying aircraft avoid overheating?
To avoid overheating, the usual trick is to select the right material:


The Concorde used a special aluminium alloy, called Hiduminium, which had higher strength at elevated temperatures and allowed the Concorde to cruise at Mach 2.02. Aluminium melts at 660°C.
The MiG-25 used stainless steel instead of aluminium to make its top speed of Mach 3.1 possible (top speed without engine damage was Mach 2.83). Titanium would had been even better, but was expensive and difficult to work with at that time. Stainless steel melts between 1400°C and 1450°C.
The XB-70 used titanium in addition to stainless steel. Its cruise speed was also Mach 3.0. Titanium melts at 1668°C.
The SR-71 used titanium for 85% of its structure to allow a cruising speed of Mach 3.2.
The X-15 was built from Inconel-X, a nickel-chromium alloy which has excellent strength at high temperature (it starts to melt at 1393°C) and allowed it to go up to Mach 6.5.
The Space Shuttle used a ceramic insulation on top of the load-carrying aluminium structure which kept the heat away from the structure during descent. Note that the Shuttle had to be connected to a heat sink to cool the on-board systems after landing.


The next trick is to fly higher up where air is less dense. Lower density does not reduce the air temperature, but it reduces the heat flow so the airframe will settle at a lower temperature. Remember that the eventual heat is the combination of convection, radiation and heat conductivity. Flying high up allows especially the top surface to radiate heat freely into the black of space above.

The hottest aircraft ever was the North American X-15 A-2. For a speed record attempt, the whole aircraft was covered with pink, ablative paint so the process of sublimation would carry some more heat away. To protect the paint from liquid oxygen, a white topcoat was applied also.



X-15 A-2 shortly after being dropped from the B-52 carrier (picture source). Note the small barrel under the lower fin: This was a ramjet which was test-flown on this occasion.



Damage to the ventral stabilizer. The ramjet separated prematurely due to frictional heating (picture source)

A third trick is to fly fast only for a short time. A heat-seeking air to air missile will easily reach Mach 3, but only for less than a minute. To keep the sensor cooled, a pressurized gas (argon or nitrogen) would be expanded (the AIM-9X even uses a stirling cryo-cooler). By heating the structure or using an internal heat sink, the limited heat load can be tolerated, albeit only for a very limited time.