Hi it still does it when the car isn't moving so i doubt its the sensor in the diff.. is there any more speed/rev sensors on the car?
strangley now it doesnt bounce up and down at 5400 it just stays there and won't rev any further
Something is afoot, regardless of what the diagnostics is reporting. There remains the possibility that the brain (ecu) is faulty, which I hope isn't the case as I believe your car could well be EWS equipped (EWS II or 2). You should be able to varify this by whether you have a fatter key and transistor fob and black plastic ring around the ignition barrel, or if not sure about that varify with a BMW dealer by calling, asking if they can in turn varify spec (they should be able to) and giving the last seven figures of the chassis number to the stealer. A non EWS ECU won't work with it, only and EWS ECU, which in turn must be calibrated to the engine/dash loom or central body electrics.
ABS sensor could be faulty (as Inv mentioned earlier) and sending what interprets as wheel slip signals back to the system, thus limiting rpm's. This is well worth a look.
The other possibles remain, such as a faulty Crank position sensor signal, or Cam sensor position signal (or combination of both, one can mask the other on proprietary diagnostics equipment such as Snap-on and Blue Point types). If you still have access to your friends donor car, then it could be worth trying the crank sensor from that car in yours first. Thats the one located down by the starter motor, a few inches forward and up from it into the block. The cam pulse generator/sensor is located near the vanos unit to the right. You should see it located to the head via a 6mm allen headed bolt through a plate with the sensors head visible. It is tucked away slightly and a little fiddly to reach I believe (could be wrong).
A partially blocked fuel breather valve (non electrical hence no diagnostics will varify this) and/or canister. Check all the vacuum lines on that system are attatched and that there is no perishing or cracking of the rubber anywhere, particularly toward the ends at joints etc. This operation will take some time as you need to track the lines under the inlet manifold etc. It is a pain in the backside to perform so be warned. If there is a crack letting air pass near to the end, there should be enough line generally to cut it shorter and re-attatch. If when the engine is being switched off are you hearing any higher pitched whistling noises etc at all ?
Another is that the oil viscosity is wrong, and that the single vanos unit isn't pressuring up or activating properly with an oil that is possibly too thin. This could concievably be sending the cam out of true normal running sync which in turn could limit rpm's. Or, vice versa the cam pulse sensor is faulty and may also be worth a try swapping out with your friends donor one. So try ther sensor first. Do you know what oil is in the engine ? Should be something like a 10w40 semi or fully synthetic. 0w30 or 40 is too thin. A 20w50 would be way too thick.
The crank position sensor and the cam pulse sensor are fairly expensive at around 60 to 80 pounds a piece retail. So well worth a trial with used ones if possible.
Lastly, and if this isn't the stupidest question ever to not yet get asked I apologise, but we HAVE ruled out a Nikasil issue haven't we. By pressure testing the cylinders each individually ?
I do maintain, I am NOT a mechanic here. I am merely trying to help. If you know better or for sure what this issue is, please do step up right now and help. I have also mentioned for you Danny to possibly ring Moseley Motorsport directly and have words with Nigel about this. Explain the situation exactly and to the best of your knowledge. He will also likely ask if it is an EWS car, with a view to possible ECU faults. But that is honestly about as far as I can go at this time without us seeing the car in person.
I know this is frustrating and like you I would love to see this fully resolved.
Ugh, another edit. Sorry. Another possible issue is the fuel pump/pressure regulator is faulty. May well be worth swapping this out also in the elimination process. That unit I think is located along the fuel supply lines toward the rear left swing arm. Or the fuel filter could be blocked or partially blocked.
http://forums.bimmerforums.com/forum/showthread.php?t=865169 to replace fuel filter. Us car in the feature but system is basically the same on UK/Euro spec cars.