A lot of long haul fares are loss making to the airline. Airlines use revenue from higher fare levels to cover the cost of discounted tickets.
A passenger making a reservation close to the travel date is often travelling because they have to rather than want to. So airlines charge more to make money. Its not just long haul. Example looking at one way fares for LHR-BHD tomorrow with BA fares range from £319-460
There used to be totally open tickets for travel inside the UK but they were the highest fare level. BA used to have standby fares between LHR-EDI/GLA/MAN etc but they were also often higher than many of the lower fare levels.