As always there's a few layers to go through to understand what your boy is dealing with.
All of these are mechanisms for defying you, which is normal and will inevitably happen. Is this in response to not getting his 3rd cookie? (I exaggerate; children will judge their parents as being unfair no matter what, they just don't understand what is at stake). As a parent you will have to be the bad guy at times, and he is going to resist. As he does so you will begin to understand how he deal with his problems.
In more detail, what he's picking up from other kids and people are two of the many facts of life: Rejection and Discipline.
"You're not my friend Daddy"
The fact is you can't be his friend, his peer. You will have to make decisions for him because he doesn't have the maturity to make himself, which makes you his superior. Once into the teenage years you can start taking the friendship seriously, but not until he's an Adult can you truly be peers.
You're right, some kid probably said that to him. As a separate conversation find out which kids he likes, and doesn't like; which ones are his friends, which ones he wants to be friends with, and which kids are mean. Teach him to self reflect: maybe he didn't share a toy with another kid, and that kid responded with "you're not my friend". Teach him to compliment others, this is a powerful tool that works very well with Adults too; "nice toy", "good idea!".
The fact of real life is people are not always nice to each other. If you prevent your child from experiencing mean people, they will not learn to deal with real life. Teach your boy to not get angry, and constructive ways of dealing with mean kids/people. Avoidance is an option to a small extent. You can teach your boy about empathy (don't use the word... just teach him to understand how other people might be feeling). The mean kid might be mean because someone was mean to him. That's not an excuse, but it diffuses anger lends some compassion and patience to help deal with kids/people like that.
"You're Naughty" / "I'm telling on you"
These are quite nice ways for him to rebel. There's plenty of more colorful phrases he could be using to show defiance :). He needs a way to vent when he thinks things are unfair.
You might want to clarify to him that when an adult calls him naughty or bad that it is his actions that were naughty, not he himself. The important difference is that naughty is not a permanent characteristic, he has the power to control his actions and amend mistakes. Teach him to "make things right again".
Reflect
My boy isn't old enough to have a conversation with yet. But once he is, I plan on making bed time a moment of reflection. It's a nice time when they are settled and will do anything to keep you there a while longer. After reading a story, talk about his day and how he felt, what he could have done differently and what he was happy about. Use your wisdom and maturity to guide the conversation to touch on the lessons to be learned (ie, guide him out of thinking "I should have whacked that kid when I had a chance"). Maybe even choose the story that fits recent problems he's facing, if he's ready to face them yet; you'll have to decide.