Hey, L.!
This is a hard one to stop. You have to enforce it like an important rule. Like it's swearing, or hitting, or anything else. Somehow he has the idea that he can get away with whining ALL THE TIME, when he understands you mean business for other things. This means his lesson wasn't firm enough regarding whining. You could even regard it as normal defiance, since you have made it very clear the rule is no whining. The light things like asking nicely. modeling, ignoring, whining back can be crossed off the list of past effort, and may have set you back by confusing the gravity, but it's not too late to start fresh.
Pretend he has never whined before. Start a new day. Sit him down and tell him he is 4 years old, and you are his mom. It is your job to make sure hes doesn't whine, it's not polite, he's a gentleman, and it will not be allowed anymore. Tell him what the consequences will be when he begins to whine. The next time he lets out the first peep of a wimper, give him a calm, firm warning not to whine. If he continues one more peep, calmly deliver a firm consequence. Let him cry for a moment, but not start a rebellious tantrum about it, and continue the discipline.
Do this every single time he begins to whine and do not ever let it slide. After several days, if this has had no effect at all (not possible, but just in case he's a medical oddity) begin to add further consequences on top of the initial harsh one such as toy removals and time outs-but never INSTEAD of the harsh consequence. Always deliver in the first moment before it escalates. Outlast him or it isn't a sufficient amount of time for him to get the picture. It may get worse before it gets better because he likes to drive you to your wits end and he likes to whine. He's used to getting away with it at least some of the time. This is normal.
You may feel completely worn out and ready to give up when suddenly you'll see him stop a whine in favor of speaking properly and acting well. You can do it! Then the fun begins as you see him get proud and happy and you can enjoy his company all day long. It does work. Once he is improving, and in times when hes being good, you can reward him with some fun activities and praise, etc, but don't bribe him with niceties up front.
No one is allowed to whine here, so they don't and they've never escalated into a full fledged tantrum at ages 2 and 4. The success is worth the hard work up front. It's not mean to teach your son to be a happy gracious non whining child. You're on the right path. He will be so much happier once it clicks.
Good work! Hang in there!