I think it varies depending on where you are going. I've gotten some amazing deals on long haul flights booking at the last minute - that's risky though.
I just booked tickets to Sweden, they would have been £40 return including taxes if I'd been able to book them around 18 days before the flight. I didn't have the cash then though, so I had to wait. I managed to book 10 days before - and the price had gone up to £70 return instead.
So short / budget - book in advance. Long haul I think the prices go cheap > expensive > cheap again as the date gets closer.