I'm not going to turn this into a "2 vs 4" debate, there are enough of those on TT, and my opinion is easy to find over there if you want to look.
But with that said, something that seems to get left out of these "4 vs 2" threads is how the machine is used. I have a KX250, and until recently also had a YZ250F. I typically re-build the top-end of the KX at about 40-45 hours, and the piston will be right at the limits and close to being out of spec. The current price for a complete top-end kit for my bike is around $175.
Now for my 250F, keep in mind, I ride almost exclusively motocross, and I rode the snot out of that bike trying to run similar lap times to what I run on the KX. I used that engine for everything it had, the entire time I was riding the track. At about 85 hours, the top-end was completely shot. Rings and piston were worn out, valve springs were out of spec, timing chain was shot, etc...it was probably past time. I paid over $700 just in parts for the rebuild, plus $150 to machine the valve seats.
So even though the 250F did go almost twice as many hours, it cost four times as much to rebuild.
Another factor that doesn't get considered in these topics is engine size. When a lot of people talk about how long four-strokes last, they are often talking about 450Fs. 450s do indeed last much longer, but it's not because they are made better, or because they are a four-stroke, it's because they make so much power that most people simply can't push them very close to their limits. Just like a 500T, which also lasts forever, because nobody can push them to the limits.
Unlike a lot of the "mine is better" arguments you see on TT, I feel that you just can't directly compare these engines, it's apples to oranges. Either type can last a long time if ridden at less than 10/10ths, and either type can wear out very quickly under the loving throttle hand of a "I can ride a 450 like a 125" rider. But in the end, a four-stroke does in fact have more parts to replace, so of course it's going to cost more to rebuild and repair.