Yes i agree, if possible look for 525i with a M54B25 2500cc engine. More power and better fuel consumption. This is one heavy car to move around.
I bought my 520i a year ago as I did not come across a good condition 525i. 525i was my initial model that I wanted.
My 520i 2200cc engine fuel consumption is around 440km for RM 100 RON95 RM1.90/litre. Once on the highway cruising it can hit 650km easily with the same amount of fuel.
Be prepared (financially and emotionally) to expect some repairs on:
1. ABS/ASC module.
2. CCV or Oil separator and the 4 hoses.
3. VANOS seals (still drivable if you are not fussy).
4. Valve seals (if consuming engine oil).
5. Absorbers.
6. Undercarriage plastic covers/shield including mudguards.
7. Cooling system (Radiator, expansion tank, hoses, water pump).
8. MID and Meter cluster pixel repair.
9. Engine and transmission mountings.
10. Front & rear axle support system (arms, bush, ball joints, bearings).
11. Spark plugs and ignition coills.
12. Headlights height adjuster fix.
13. Fuel pump & filter.
14. Transmission rebuilt.
Not trying to scare you but these are some things that I went through and going through. This list is some of the problems of E39 but not limited to these only. It's a routine to all used cars that you will buy now or in the future not only limited to BMW.