Frankly, it never occurred to me that I could rearm and head back out without ending the patrol. Don't you want equipment upgrades and new crew as soon as possible?
I stay out as long as the fuel and torpedoes last, or until the boat takes a lot of damage. I think my longest patrol so far was about 50 days, when I was having trouble finding targets. Shortest was less than a week.