I've only played MGS2 and 3 before MGS4, but I'd probably rank 4 behind 3, but ahead of 2.
I absolutely love 4's gameplay in the first two acts, and I really feel like it improves on the best parts of MGS3's camouflaged, open-ended sneaking, with bigger environments, a much easier-to-use camo system, and a smoother control scheme. Even when the gameplay starts to deviate in later acts, it's still generally strong.
But in terms of overly-long cutscenes filled with exposition and heavy-handed philosophy, MGS4 tops even MGS2, and while it at least avoids relying on the codec to communicate everything, there's still just way too much of it, and it's not good enough for me to enjoy all nine hours of cutscenes. It builds the same absurd web of subplots and ridiculous plot twists.
I loved MGS3's story, because where 2 and 4 get drowned in their own canon and message, 3 keeps things straightforward, focusing on a few characters, but making that relationship strong. It also has a strong message that's pretty overt, but it doesn't bludgeon you with it to the extent that 2 and 4 do.
I thought 4's story was weaker than 2's, but I like the gameplay so much that I'd say it wins out. But 3 has the perfect mix, and that's why it's my favorite.