There's not much you can do to lengthen your recovery.. just make sure you're going at full horizontal speed before you input up-B. Also, when trying to maximize your range, don't do up-B until the last moment before an up-B would no longer reach the height necessary to grab the ledge.
If you're off the stage but fairly close, you have a more options. Here are a few:
1. Clawshot the edge. As long as they are not currently edgehogging, this will get you safely to the edge instantly.
2. Sweetspot the edge. If your opponent is a short distance into the stage and obviously waiting to hit Link as he overshoots his up-B since it doesn't autosweetspot, then you should respond by manually sweetspotting; i.e.
3. Deliberately don't sweetspot the edge with your up-B. If your opponent is too close to the edge of the stage or if he is trying to edgehog, you can show them that even though Link's midair up-B has sucky damage and range and only hits in front of him, it DOES have good priority; much more than most people expect. Eventually they'll learn that they have to protect themselves from this option, but punish them every time they forget.
4. Air dodge - if they try to hit you in midair, this should be your first instinct anyway.
5. Fair, Nair, Zair - if your opponent is jumping out to spike you / hit you further away, you can hit them first or cancel the projectile in some cases, though an air dodge will usually be safer. Trouble is you have to do this while still pretty high in the air or else you'll fall too low...
6. Bomb throw - obviously you'll need to have a bomb in hand first, but throwing a projectile makes it that much harder for your opponent to gimp you properly.
7. Hold a bomb - if you plan on being out on a limb for a long time for some reason, holding a bomb will eventually cause the bomb to explode, thus knocking you up and theoretically close enough to the stage to recover more safely. This begs the question of why you PLAN on being in trouble for so long, but it's better than nothing.
Whatever you do, DON'T up-B so early that you reach the edge in your "used recovery" state; you'll get either edgehogged or smashed for sure.