It's not hard. If he's getting bored with the relationship and has a wandering eye, it's not your problem. It's his and like apple said, it makes you wonder if he was into the relationship in the first place.
I think it's the opposite. It's much tougher to keep a woman from being bored, especially since women have so many options. They get approached so often, so if we can't keep her interested, we get dumped for the man she apparently finds more interesting! :P
Eh, there's nothing you can do to prevent someone from getting "bored". There's way more to relationships than sex, hugs, kisses... etc and many people within your age group don't realize that yet. So eventually many of them start looking for something new even if it's worse. Things get kind of static in a while and I believe so long the partners involved constantly care for each others, there should be no room for "boredom".