In all honesty, it probably *will* affect your friendship for a while. Expect him to be hurt, maybe angry, and maybe he'll avoid you for a while. That's normal: people don't like rejection. What you need to do is still be there for your friend, keep talking to him as a friend, and when he's ready to resume the frienship proper, be there for him. Just because its you that has rejected him, it doesn't mean that you can't counsel him about it.
With the second guy... honesty, probably. Tell him, "I know you have a girlfriend and I don't want to have anything to do with that. I'd just like to be mates, ok?" Perhaps make an effort to get to know the girlfriend, too, so that she doesn't see you as a threat.