I am also seriously considering an M340i next.
I'm still really happy with the 530d but my mileage isn't what it used to be since we moved and I've had it 4 years now - it's 5 years old soon.
The obvious choice and what i'd still prefer is a 540i M Sport, however there are a number of issues with these, namely:
a) The specification of UK cars is poor. I don't have the budget for a new one so I rely on AUC cars circa a year old. Virtually all of them are missing ICON LED lights and I've yet to see a single one with Driver Assistance Plus package. All people care about is massive wheels and M Performance grilles. It's a real pain
b) The LCI was initially encouraging but has resulted in the end of the 540i in saloon form. It has now been replaced by the 545e, which is an interesting car that may work but again the styling heads more and more in the wrong direction, particularly wheels - there is no wheel option on the LCI 5 Series M Sport that isn't black and looks like something Wolfrace sold through Halfords 10 years ago.
So, enter the G20 3 Series. I took a 320d M Sport out for a day last year as a courtesy car and was impressed - the interior is no longer the cheap plastic bargain bucket of the F30, it feels much more like a smaller version of bigger BMW models again not an oversized 1 Series.
A 4 cylinder BMW is unacceptable which leaves the 330d, M340d or M340i. I would happily have either a 330d or an M340d but given my regular long distance trips up and down the M5 are now a short town commute, the odd 60 mile round trip for work and a trip to Heathrow every few months I have concerns about diesel for that purpose - plus the hysterical and misjudged anti diesel backlash isn't going away.
So, that leaves the M340i. Most are very well optioned and if you can find one without the silly M Sport Super Shadow Plus Ultra Mega Shadow pack with the standard 19 inch wheels they have 35 and 40 profile tyres, are entirely silver, and look fantastic in Portimao Blue.
It's still difficult to find with Driver Assistance Pro, and they are annoyingly xDrive only, but other than that they look very nice - plus dimensions wise its basically the same as an E39 5 Series. Another bonus - because I don't want a small car despite not needing a big car.
Power wise 540i v 340i - couldn't care less. Both have more power than you can use in the UK without getting in trouble. I've had a couple of 540i's for a week or so and have found the performance to be nothing short of incredible. The extra power in the 340i is obviously a bonus but doesn't make much difference to my decision I don't think.
As for the alternatives - I have driven them all extensively (ie, 1500 miles+ on each) in regular form and would say the C class is unfortunately very dated now - shame as it looks fantastic and would be unacceptable as a result. The infotainment system isn't just poor, its a constant frustration. The next C Class will have MBUX and as a result will probably be the complete opposite and be absolutely fantastic. The A4 I have driven as an A5 but as mentioned above the S4 is diesel only. E Class - just been facelifted, never driven one, might be quite good with MBUX. Audi A6? No thanks. Jaguar XF? I'd rather walk.