We've encountered that question recently as my husband's carbon bike from 2004 has hit somewhere around the 55,000 km mark (35,000 miles) and lots of components are having a hard time. He debated just getting new components for a while (wheels especially) and I asked my trusted mechanic about it.
If I remember correctly, in his (my trusted mechanic) opinion, as long as the frame has no cracks or other signs of damage, it's fine to ride forever.
Now that my dear husband is getting a Cervelo R3, his good ol' Trek will become his winter bike and I can foresee another 50,000 km before it's retired.