There are several possible reasons that your cat could be exhibiting this behavior. What you do about it depends on why he is doing it.
Your water is fresh and clean. Perhaps his water is old or his bowl is dirty. You could try cleaning his bowl, refreshing his water more often, or installing a fountain to keep his water fresh.
Your water is near you (where he wants to be) while his water is far away. You could try making sure he has water near each place you hang out (in the living room for when you're watching TV, in the office for when you're on the computer, in the bedroom for when you're sleeping, etc).
He's bored. You say he gets plenty of attention, but petting and affection isn't the same thing as hunting with an interactive toy. You should make sure that he gets plenty of stimulating play toy with a feather wand or fishing lure type toy each day. At the end of the play session, feed him his dinner or a small treat to stimulate the natural hunt-eat-groom-sleep cycle.
Finally, sometimes cats just do things for reasons that we humans can't quite figure out. Often I'll remove the item that triggers the behavior for a few months (so stop leaving cups unattended) and by the time I start relaxing and allowing that item to remain in their environment, they'll have forgotten about that annoying behavior.