Without any fanfare, the U.S. Air Force recently announced that it would spend $11.9 billion to keep its remaining B-52 bombers in service until they are all retired by 2040. At that point, the last ones will have served over 70 years. The new "sustainment program" will cost over $150 million per aircraft, which is about twice what they cost to build (accounting for inflation).
The reason for this investment in half century old aircraft has a lot to do with the fact that the B-52 is very capable, reliable, and cheap to operate. This is especially true compared to the aircraft built to replace it (the B-1B). The U.S. Air Force has been having a hard time keeping its 67 B-1B bombers ready for action. Two years ago, the availability rate (aircraft you can send into action) was about 51 percent. Seven years ago it was 56 percent. Progress is being made, but the B-52 is still more reliable. The B-1Bs are used to drop smart bombs in Iraq and Afghanistan. They are particularly popular in Afghanistan, because you can put one in the air, and it can cover the entire country. While the B-1B is twice as expensive to operate (per hour in the air) than the B-52, the B-1B can more quickly move to a new target over Afghanistan.
B-52s are not only cheaper to maintain, they have a higher availability rate (65 percent.) As a result, the air force wants to keep 76 B-52s in service (despite a Congressional mandate to reduce that number to 56.) With the development of GPS guided bombs (JDAM), heavy bombers have become the most cost-effective way to deliver support to ground forces. The B-52 is the cheapest American heavy bomber to operate, and the oldest.
The new sustainment program includes continuing upgrades that are already in progress. This includes replacing the 30 year old APQ-166 strategic radar. The B-52 users would prefer to have a modern AESA (phased array) type radar, but the air force is reluctant to spend that much. That's because the radar upgrade will accompany the addition of new communications gear, to allow the B-52s to participate in the Internet like network the air force is creating for its aircraft. This also allows the warplanes to communicate with similar networks being built by the army and navy. The new sustainment program may give the B-52s even more advanced equipment after all.
The B-52 has had a lot of competition. In the last sixty years, the air force has developed six heavy bombers (the 240 ton B-52 in 1955, the 74 ton B-58 in 1960, the 47 ton FB-111 in 1969, the 260 ton B-70 in the 1960s, the 236 ton B-1 in 1985, and the 181 ton B-2 in 1992.) All of these were developed primarily to deliver nuclear weapons (bombs or missiles), but have proved more useful dropping non-nuclear bombs. Only the B-70 was cancelled before being deployed. The successors to the B-52 were more complex and expensive since they were designed to penetrate ever more formidable air defenses. The B-52 needs none of these improvements for the bombing missions against foes with no air defenses against high flying aircraft. Moreover, defense is now more a matter of electronics than higher speed or stealth. So the B-52 is still competitive, even against defended targets.
The well maintained and sustained B-52s are quite sturdy and have, on average, only 16,000 flying hours on them. The air force estimates that the B-52s won't become un-maintainable until they reach 28,000 flight hours. The B-1 and B-2 were meant to provide a high tech replacement for the B-52, but the end of the Cold War made that impractical. The kinds of anti-aircraft threats the B-1 and B-2 were designed to deal with never materialized. This left the B-52 as the most cost effective way to deliver bombs. The B-1s and B-2s are getting some of the same weapons carrying and communications upgrades as the B-52, if only because these more modern aircraft provide an expensive backup for the B-52.
The B-1B and B-2 are more expensive to operate because they haul around a lot of gear that is not needed for the current counter-terror operations. The B-1B can travel at high speed and very low altitude, to evade enemy air defenses. The B-2 is very difficult to detect on radar, but this ability is achieved with some expensive to maintain design features. Back in the 1950s, when the B-52 was designed, air warfare was a lot simpler, and so was the BUFF (Big, Ugly, Fat Fella, as the B-52 has long been known.) There are still potential enemies out there with Cold War grade air defenses, and the B-1s and B-2s are maintained to deal with that eventuality in mind.