In general, your characters will be assumed to be fictional, unless you give overwhelming reason for them to be considered otherwise.
Which means that you're asking the wrong question. There's no one twist which will make a borrowed character untouchable in his "disguise"; there are only ways that you, the author, can expose that the character is borrowed.
A trivial example: You can create a character in a 3rd-century proto-Viking setting and introduce him as the anthropomorphic personification of infertility. But if his name is "Charlie Chaplin," he has a small mustache and a bowler hat, and you describe him eating leather footwear in the snow, well, people are going to recognize the resemblance.
What you need to avoid is unique, identifying features. Moving Barney Stinson to the 18th century doesn't render him unrecognizable if he still bellows "Legendary!" and high-fiving French revolutionaries. Likewise, your friend's life history might be rendered unrecognizable by transplanting it to a different time and place, but then again, if it's specific enough, it might not. When you're portraying a very specific, real-life person, it might be clear what parts of your portrayal are entirely fictional and don't reflect in any way on the actual person. But then again, if your writing has convinced people that you're trying for a one-to-one correlation, it might not be.
Your question seems to be operating on the assumptions that:
- You'll be copying a real-life person so faithfully that the parallels will be fairly clear, and
- That person might object to your use of his personality and/or history in your book, or to your portrayal of him.
There is absolutely no reason to reach this kind of scenario in the first place. If you are in the position where you are looking for a way to disguise that a character is based directly on somebody real, then you are already doing something wrong.
All you need to do is this:
- In general, when creating characters, never base a character entirely on a real person. It can't be "This is Brad, but in the Wild West." Brad might be your starting point, but you need to develop the character in its own right - and you'll want to develop the character as something other than "absolutely identical to Brad."
- Avoid unique, personal identifying details. Avoid them like the plague. Heard a marvellous, OMG-I-Can't-Believe-How-Evocative-That-Is personal story? Don't use it. It can influence you, but it isn't yours to copy wholesale. And if you're copying material wholesale from people's lives, they could be justified in their accusations that your writing can reflect on them directly.
- If you do really want to use something entirely real, and no substitute will do, then ask permission. Explain what you're planning to do; give context. "Sarah, the story you told me about the last time you saw your dad is really sticking with me. It would be really perfect in a story I'm writing. The characters would be totally different from you guys, but that one scene would be almost exactly the same. How would you feel about that?" Or "Emma, I've got these terrific ideas which are all basically you as a starship captain. I'm totally imagining it as what you'd do if you were there. Are you OK with that?" Listen to them; address their concerns. Perhaps they'll want to go over your work before publication; consider whether or not you're OK with late edits or vetoes. And if you do agree to something concrete, ask for it in writing - "yeah, I know, it's just a formality, but professionally I have to have this."
Hope this helps.