Very broad topic there... Mostly playing consistantly with clicks, and recording in different situations has improved this for me. But time keeping is a very broad scenario, and there are elements of awareness that take over just by playing the instrument over the course of years.
This can't be boiled down to an exercise necessarily, but knowing where to sit time wise for different styles is important, so developing the ABILITY to sit anywhere..tight, loose, behind the click, in front, etc....this ability is what you are after. Whatever means you use to get there is different for everyone. But I work on these things with a click constantly and it seems to pay off over time.
Hope that helps!