Using large parts of a research paper
You should note that you can use all of the ideas of the other paper, so long as you give proper attribution and citation so that you don't claim the original as your own. You can't, however, use "too many" of their actual words and must quote and cite the ones you do. The first issue is plagiarism and the second is copyright. Be sure to avoid both.
But if you write a proof that has the same structure as the other, using the same lemmas and referencing the same earlier work, it shouldn't be a problem, especially as you say you will explicitly state that the overall structure is the same.
You don't need to work to make it seem different where it isn't. For some sorts of things, especially in math, there may be, in essence, only one way to properly state something. This is recognized both in law and in practice.
However, it is possible that reviewers will suggest to you that your work isn't especially novel and may want to reject it on that basis. But if your conclusion is sufficiently interesting, and you support that idea by making it explicit, you may avoid that pitfall also.
I would discuss this with your adviser, but in general, you can rewrite chunks and state explicitly things like "This is the same method as Foo, but instead of inequality A here note we now use inequality B" and things like that. Another thing to do that may be useful is to split things up into separate lemmas. If something is explicitly a lemma in the original one just needs to cite it. If one has a slightly more general lemma, one just needs to say it is the same technique and say a few words about how the proof is slightly different. If the original isn't broken down into small chunks, one can make those chunks yourself and then for each say things like, "See page n of Foo" or something similar.
One thing to do also is if it is very close to an earlier paper is to make sure that that's explicitly noted in the paper. Note that it isn't just a generalization but that it uses similar techniques. Also, make sure to send drafts of your paper to the original authors before you send yours out.