How many years from the year the motorcycle was built should you hold onto it before the parts become too expensive

For example I was interested in buying a 2006 Honda CBR600f4i until I looked up the price of the fairing pieces. Just a small piece of the fairing was over $600. Of course they charge that price because they want you to buy a new motorcycle.

No set time - depending on the bike and the maker that will vary drastically

After a certain period, especially with a popular bike like the cbr600, you will be able to find secondhand parts relatively easily, and in good condition if you wait and shop around (make sure you can see any plastic tabs and mounts on the back before hitting buy). They have the benefit of ageing in similar conditions to your bike, so the colours aren't too different (unless it has been under the blazing sun).

Honda prices have always been on the pricey side too, compared to, for example, Yamaha.

If you really can't find a part you will be able to find a fibreglass replica made in China which can be painted up to match yours.

No, they charge you that price because they're rare, and become more rare over time - they don't make them any more.

Just a small piece of the fairing was over $600.
So why aren't you buying a motorcycle that doesn't need a piece of the fairing? Unless you're dropping it on a fairly regular basis, why would it need a piece of the fairing?

Depends on the brand of motorcycle, how popular your specific model was & how many years it was made before they changed & upgraded the design.
You can get most parts for popular Japanese models 7 to 10 years old, after that the manufacturer no longer makes or stocks parts for that model & you have to search for old dealerships that MIGHT happen to have some forgotten old stock in the attic.

The high end bikes like Harley, BMW .Motoguzzi etc that don't routinely change their basic design every year things are much easier.

For my 11 year old Harley dyna I can get any stock or after market up grade parts that I might want.

For my 35 year old 1982 Shovel head FXR I can still get any stock part but many of the aftermarket engine hop up parts are no longer available.

For my 70 year old 1947 knuckle head I can only get totally stock parts & i have to order them from specialty catalogs.

Fairing is always expensive be it old or new so buy one with a good fairing and don't drop the bike. I have a 20yo Honda VFR750 in green which is immaculate, but if the fairing gets damaged the bike would be a write off. A red bike may be repairable because there's plenty around so remember that unusual colours can be a problem.

Fairings are always expensive.

Doesn't matter if it is a car or a motorcycle. Parts bought individually cost more than the whole.

If you took the parts book and bought everything to build a bike it would cost 20 -30 times more than the bike on the showroom floor. It has nothing to do with them wanting to sell more bikes. It has to do with warehousing and distributing all of those parts.

As to when it is too expensive that is up to you.

All motorcycle parts are expensive. They don't necessarily get more expensive with the age of the bike, they get harder to find.

Fairings and other parts don't usually increase at any higher than the rate of inflation until the bike is no longer supported by the manufacturer. Didja check the price of fairings for 2017 motorcycles?