At first I thought you meant powerful NPCs like "The lich you have to beat is about 3 CRs above what you cna handle, go get 'im."

But now I understand.

I've used powerful NPCs as allies and mentors a number of times. Often they aren't free. One was a high level elf ranger who the party often went to for assistance traveling thorugh wild terrain (the aprty lacked their own ranger and most of them had only a couple ranks in Survival). They'd often have to help the ranger raid some Orc encampment or outpost in return (his favored enemy was orcs) otherwise he could totally wipe the floor with them because he had almost EVERY two-weapon feat and a number of powerful magic items.

On other occasions I've had NPCs that were the same class as a player but a couple levels higher, worked out before the game that they were the character's mentor and were traveling witht ehm to help them become stronger, but not do the work for them. It worked rather well adn made for good plot later on when the big bad kills the mentor and the player (the actual player, not jsut him being in character) swearing to get revenge.