Don't bother trying to be nice. Be firm and if necessary be rude. Tell him flat out you don't like those comments. Next time he says anything inappropriate, stand firm, look at him firmly in the eyes and tell him, "Don't talk to me like that. It's not appropriate and I won't accept it." No please, no thank you, no I'd appreciate it... nothing nice. If he offers freebies, same thing, "No, I don't accept inappropriate gifts." Lots of firm, clear no baloney answers. Get harsher if if doesn't stop.
For inappropriate language-appy
Edited to add:
Sorry about that, all! I'll try to be more thoughtful of others and think of who might be reading here.