"You own everything that happened to you. Tell your stories. If people wanted you to write warmly about them, they should've behaved better."
The first time I came across the ethical question of blurring the line between fiction and nonfiction was as a teen. A slightly paranoid friend in high school told me that her ex-boyfriend based a character in his play off of her and that she thought it was morally reprehensible. More recently, while reading the manuscript of a friend, I came to the realization that one of her characters was based off me. An odd sensation to read a fictionalization of yourself, but she was just a side character with my physical traits who would occasionally slip in literary words of wisdom to the narrator (in fact, the worst thing I might say is that I read a bit dull as a character).
In my own writing, however, after leaving behind the sadly autobiographical stories I wrote in childhood, I've tried to avoid basing characters directly off people in my own life. Working on some of my more recent projects however, I've discovered that it's inevitable. As writers, our minds are our landscapes. Everything we've read, seen, or experiences is what we funnel into our stories. Most importantly, the people we meet shape us.
I doubt there is any writer who can honestly say that nothing they've written has some basis in an experience they had or a person they've known. I think we often end up playing the "what if?" game. You start with an amusing or interesting situation from life and invent from there. Say, a late night volleyball game on the beach with your friends. Now you say "what if a treasure map had washed up on the shore that night?" or possibly, "what if Gary and I hated each other more and took out our animosities during the game?" There must be a story in that. The game in real life might have been tame, but throwing in those other variables makes it plot.
Some characters will become a composite of people I know. They might have one person's occupation, another's penchant for compulsive cleaning, but I develop completely fictional relationships for them within the story. Sometimes, if a close friend is being used as any sort of basis, I'll clear it with them first. I'll let them know that I'm lifting a bit of their physicality, or a circumstance from their life and using it in my story. So far no one has objected.
In most cases, I doubt someone reading my novel would pick out what they had been the inspiration for. I do have ethical qualms about making a direct transcript of a real person from my life to a character. But I can't pretend that my stories don't have the occasional non fiction basis. As a writer, I feel I have a sort of duty to capture the reality of human experience. Fiction is real in that sense, it can be a recognizable truth about life from a story that didn't happen, at least not exactly. It didn't happen, but it's still true.
Even more problematic can be injecting a "me" character into stories. It can be so easy to slip into writing about a hero that is basically your own self, especially when writing in the first person. I think a little bit of yourself will always be present in your characters. After all, what they say and do are filtered through you. But, sometimes it's really liberating to write from the perspective of someone totally different. A different background, different stance on issues, different race or gender, different age: I think experimenting with that can help you get outside yourself as a writer. And that can be so good for the work.