Your problem apparently started with problematic fuel and is associated with a lack of power. Your trouble codes are odd, see below, but at minimum see what's coming out on the tank at the inflow line to the fuel filter head even if you have to run a siphon. Alternatively you might consider removal of the fuel filter and pouring its contents into like a glass jar to see what things look like. In addition go to Sam's NOOB guide and get a copy of the 06 FSM as it has most all the trouble codes and diagnostic procedures. What codes are not in the 06 FSM are in the list at
viewtopic.php?f=98&t=40073As to your codes - NOTE I strongly recommend a fuel check first as noted above.
P0101 is MAF SENSOR SIGNAL NEGATIVE DEVIATION
P0299 LACK OF POWER ON TURBO - is really BOOST PRESSURE SENSOR POSITIVE DEVIATION which under normal circumstances would imply a bad boost pressure solenoid and suggest doing the solenoid bypass to confirm
P1265 is glow plug #3 control circuit low
P1140 WATER IN FUEL CONDITION is actually VACUUM RESERVOIR SOLENOID SHORT CIRCUIT - I'm guessing but this is probably related to the P0299 -
UPDATE see CATCRD's later post that P1140 may actually relate to the Flow Control Valve
P0183 - not listed in the FSM but a Google search suggests a fuel temperature sensor issue (IIRC the temp sensor is the passenger side plug on fuel filter head (see Sam's fuel filter bleeding video)
P0504 is BRAKE SWITCH SIGNAL CIRCUITS PLAUSIBILITY WITH REDUNDANT CONTACT
P1263 is glow plug #2 control circuit low
Based on your initial post I still lean toward bad fuel but assuming the codes you pulled are valid:
1. unplug the MAF sensor - doing so is harmless although it will throw a MAF code and doing so will remove a MAF sensor signal problem (it's what triggers EGR usage) from the loss of power equation.
2. ignore the 2 glow plug problems for now. It's certainly possible you have 2 bad glow plugs but that would cause hard starting in cold weather (don't know where you are, except not US, so don't know weather) not the loss of power you report. In the long run if you have bad glow plugs consider the drop in replacements from
http://www.dieselglowplug.com/gx3123-di ... svli5qq877 3. unplug your fuel filter head temp sensor wire which removes that from the loss of power equation.
4. bypass the boost pressure solenoid per
viewtopic.php?f=5&t=70602&p=757348&hilit=boost+solenoid#p757348 (link corrected) and check for a collapsed vacuum line per
viewtopic.php?f=5&t=61240See if doing this, all steps, brings power back.
I'm assuming you are not trailing a cloud of dark black smoke which would imply a split in one or both CAC hoses. It's also possible that one of the above or something else has kicked the vehicle into "limp" mode but I cannot offer much advice on tracing that problem down other than it would not be glow plug related.
As to the brake switch code I cannot comment other than what the FSM says.