Most engineers I mentor make the "mistake" of only focusing on being good at "programming". There is nothing wrong with it, but I'd argue that there is a much lower ceiling than if you were an expert at both programming in general and some niche topic.
In my case I'd say math is the other leg I specialize in, with market micro structure being a close third.
In the general case it could be something like SEO, visual design, or a particular industry like logistics.
The other way to make more is to be closer to the money. If you are developing a product then you are considered a cost center, ie a negative on cash flow not a positive. Sales on the other hand is often the canonical example of a boundless upper limit on compensation as they can directly draw a line from incoming revenue to themselves.
Don't be a programmer, be an engineer who can solve real world business problems. Even better be able to draw a straight line from your work to incoming revenue!
$200k+ (total comp) for an IC isn't rare. Google, Facebook, Netflix, etc. will all get an experienced senior engineer well into that range.
Last year the .01% of engineers, the best of the best, people that Apple, Google, Facebook, Netflix seek out and recruit, topped out at $325K for their total comp (salary, health plan, 401K match, bonuses, everything).
Bear in mind that these are the best people, people that can code, can communicate, can ship. Most people don't make this because they are not this good, which is fine. I'm just letting you know how high you can go if you are very, very good at engineering. It's kinda cool, when I was an IC, there was a pretty hard ceiling at about $150K, if you wanted more than that you had to manage.
Also bear in mind that I'm a single source and may have gotten the wrong info (though if that's the case I'd love to be corrected, I use this info for how I comp my people).
If he really just wants to code, the best way to maximize income would just be develop a career as a consultant rather than a staff engineer. The biggest opportunities for writing code for a ton of money are in a few intense roles, usually associated with R&D on a core product. It's not easy to stumble into those opportunities, and if your friend had the skills to go down that path, he'd already know.
Mentoring and training employees with less technical skill. Reviewing workflow and looking for ways to "work smarter not harder". Developing tools which help us internally. Prototyping ideas which could become customer-facing value-adds. Finding ways separate parts of the business can help each other. One group will do something another group doesn't, how could having that insight help the second group and vice versa?
Effectively you have to become like a well known actor. So that when someone is starting a project ('movie') they want to hire you for it no matter the cost.
Reading this might also be useful.
If he "just wants to code," he's going to get stuck. If he wants to be a software professional, the sky is the limit for skilled individuals.