The answer depends on location, company and job role. There are some companies (Big 4) where there is a path to growth as an individual contributor even after 35-40. Please remember though you tend to spend a lot of time in meetings in these companies as you grow. A lot of popular Open source projects have senior developers as contributors and these people are sought after by multiple companies.
I have also seen a lot of senior developers go into consulting although they have to do a lot of other stuff than coding. I think as a senior developer you do need to be good at little bit of project management (ex: guiding junior devs, de-risking a project completion, contributing to product management decisions). If that is the case and you have a leadership who can recognize the technical value you bring to table, you should be handsomely rewarded.
I have also seen a lot of senior developers go into consulting although they have to do a lot of other stuff than coding. I think as a senior developer you do need to be good at little bit of project management (ex: guiding junior devs, de-risking a project completion, contributing to product management decisions). If that is the case and you have a leadership who can recognize the technical value you bring to table, you should be handsomely rewarded.