The entire runway surface is inspected for FOD (Foreign Object Damage), is built to the same weight spec and has the same wing clearances at the edges for obstacles - so there is no reason to specifically follow a yellow line on a runway (providing you don't taxi off the edge, of course!)
On a taxiway, however, different areas are built to different weight spec, the lines are painted specifically to guarantee wing clearance, and off the yellow line you find much more FOD.
I once took a shortcut, off the yellow lines, on the apron and picked up a nail in a tyre - so spent four hours with an AOG aircraft waiting for a replacement.
At least if you follow the lines, you have a good chance that the aircraft ahead has followed the lines, and picked up any FOD before you.