How much am I allowed to edit my ESL friend's Master's Thesis?
It sounds like you're doing all the right things regarding helping without actually writing for your friend. I would explain to your friend, and ask them to meet with their adviser, either with or without you, to discuss how much/what type of help is appropriate. With the adviser included in the process, and some boundaries identified, it will be clear that plagiarism is not taking place. That being said, this is a huge time committment on your part. It might help you and your friend for them to work with a writing coach. Your school probably has a writing center or ESL center that can help with this.
As far as I am aware, the use of proofreaders to correct grammatical or usage errors is not normally a problem. Regulations cover the intellectual content—the ideas should be those of the Ph.D. candidate, but there's no reason they shouldn't be able to have someone help them with writing.
If there's a writing center that students are encouraged to use, then it would stand to reason that a friend should be able to help. Your creation of a paper trail through a marked-up copy shows your contributions and should act as a defense in case there is an accusation of plagiarism.
This isn't about plagiarism; it's about academic honesty. Your statement that the paper is now "dramatically changed" points to that. If the paper is 60% your friend's work and 40% your work, this is dishonest. 20% your work is dishonest---that's one chapter out of five.
This is a very common problem for nonnative writers of English at the PhD level. When a university grants a degree, there's an assumption that the student is leaving with the ability to function professionally in an English-speaking environment (regardless of where the person plans to live and work). Language skill is inseparable from subject-area knowledge. I've worked as an editor with PhD students and new professors from other countries for many years. It's clear to me that their level of English is directly related to their ability to understand and analyze complex concepts. Both mature simultaneously over time.
I NEVER edit a dissertation so that it turns out at MY language and intellectual level. This would be an ethical violation and a disservice to the student. Those who plan a career in academia will immediately be faced with much higher challenges as soon as they have their PhD in hand: the journal articles and book required for tenure, followed by active research and writing for the duration of their career. If I do their work for them now, there will never be an end to it.
From what you write, it appears that your friend is simply not equipped to write a dissertation. I know this sounds harsh, but a dissertation isn't a trivial thing. It represents years of study and hard work. As an editor I could turn out a dissertation for an ESL student that would be superior to one written by a native English writer. That would be wholly unfair. Students and faculty from other countries simply need to come to terms with the fact that they have this challenge to overcome and that overcome it they must. Thousands have done this, and your friend needs to bite the bullet as well.
My advice: pull out of editing this dissertation. Tell your friend, "This really isn't ready to be edited. You need more help than I feel comfortable giving."
Sorry to be so long-winded. This is a really important issue. When your computer is getting eaten alive by a worldwide virus you want to know that the person charged with eradicating the virus did his or her own work in the PhD program. So many important roles in society related to our safety, health, financial well-being, and so on depend on competence fairly gained through one's own hard work.