Well, if you dont want to him to be flirting, then why not just say it?
Why would it be wrong, in any instance, to say "look, we're mates, thats it, i have a boyfriend, let's keep the chat to friendly banter"?
That way, he would know you really didnt want anything extra curricular and he would stop trying.
The texting, asking for a hug, giving you free drinks, etc, is clearly him flirting and, seeing as he's married, wanting a bit of extra.
Even if you are flirty by nature, by flirting with him, you are giving him a green light to try his best to get what he wants.
Next time you see him, tell him to stop the mild attempts to get with you......it doesnt have to be anything bad you say, just as long as it's made clear you dont want anything more than friendly banter with him.
Mind you, by telling him, it'll probably mean he wont talk to you as much, the texts will stop and there will be no more free drinks.....