The engine, definitely. Putting a diesel in there would bring the consumption way down.
Seriously, though, there are a few things which will help. A dirty air filter and infrequent oil changes will result in slightly increased fuel consumption (the filter because of constricted air flow and the oil because of diminished lubricating capability - pretty minor effect, admittedly). Problems with the ignition system can result in incomplete combustion which will result in reduced fuel economy. A defective or worn-out oxygen sensor will send a "lean" reading to the fuel injection control system, resulting in an unnecessarily rich mixture. Underinflated tires will reduce fuel economy. Finally, but most significantly, driving habits are a major factor, so watch your economy gauge!
All that said, don't start replacing parts unless you know that they're defective or worn out; you'll spend a lot of money for little or no return in fuel cost savings. The MB gas engines (particularly when mounted in a car like the S-Class) do not offer particularly outstanding fuel economy, and most require premium fuel, so if your fuel costs are giving you heartburn, then you maybe should consider another alternative; the diesels are much more efficient.
If the clatter and smoke of a diesel are a turn off, there may be some consolation in the fact that gas prices are slowly coming back down - for the moment (at least where I am).