It depends on what type of beer you are making, but in general, 2-3 weeks for an average gravity beer is perfect. It only takes a few days for active fermentation to be complete, but after that, the yeast will actually go back and eat their own byproduct, which minimizes off flavors and enhances the quality of your beer. After that, the beer starts to bulk condition the same way it would condition in a bottle anyway, so any extra time just promotes better beer as well.
I leave all of my beers except for wheat-based beers (best young) in primary for at least 3 weeks. Whenever I have a good pipeline going, I leave my beers in primary for more like 6-8 weeks, and the final product is always better as a result.
Also, just FYI, high gravity beers require exponentially longer fermentation, conditioning, and carbing periods, so anything over 1.065 OG or so, you'll always need to factor in additional time in the primary as well as additional time to carb and condition. All of the chemical and biological processes in wort/beer go slower in higher ABV environments.
Good luck!