Four years, according to the introductory plot summary of Seneca's play Phaedra, is the amount of time Theseus was in the Underworld.
The Mechanics Thereof
I think you've answered your own concern regarding how it is Theseus and Peirithous were able to remain alive while they were trapped in the Underworld. Considering the powers possessed by the gods and the nature of the narrative world in which these events are taking place, any number of explanations that one could imagine would probably work just fine to deal with this issue.
Other suggestions might be that time does not pass in the same way in the land of the dead, or that sitting in the Chair(s) of Forgetfulness is like being frozen in cryostasis while still remaining conscious, and so on and so forth. One might not even need to posit necessarily supernatural means by which these unfortunate men were kept alive. People in the upper world throughout history and even at present day are imprisoned, with their lives deliberately sustained, in far more extreme-sounding situations than this.
There is, however, at least one ancient version of this story which is intentionally designed to make it more plausible to those who do not buy into the supernaturalistic descriptions of Hades' realm. Plutarch's Life of Theseus provides a completely euhemerised version of the story, in which (Ch. 31) Theseus and Peirithous never go to the Underworld but rather, after abducting Helen from Sparta, go to Epeiros [Epirus], where there is a king of the Molossians called Aidoneus.
This man called his wife Phersephone, his daughter Kora, and his dog
Kerberos, with which beast he ordered that all suitors of his daughter
should fight, promising her to him that should overcome it. However,
when he learned that Peirithous and his friend were come not to woo,
but to steal away his daughter, he seized them both. Peirithous he put
out of the way at once by means of the dog, but Theseus he kept in
In The Life of Theseus 35, while Herakles is a guest of Aidoneus the Molossian, the hero hears of Peirithous' death at the mercy of the king's dog, which he can do nothing about, but, after interceding on Theseus' behalf, his captor agrees to release the Athenian.
As is probably obvious here, Aidoneus is supposed to be Haides [Hades], while the names of his wife Phersephone and daughter Kora are both references to different forms of the name of Haides' niece and wife Persephone. Even in this, the methods that the human Aidoneus and the divine Haides might have employed to both imprison and sustain Theseus need not have been terribly different at all from each other.
Theseus as Compared to Herakles
In all the mainstream ancient accounts of their respective careers, Herakles [Heracles] is definitely older than Theseus, having established himself in his heroic roles before Theseus does.
One of the most problematic chronological discrepancies of Greek mythology might provide an exception to this format, in which grandchildren of Theseus and Ariadne are already full-grown when both Herakles and Theseus himself are supposed to be in the midst of the peak of their adventures. In different versions the wine-god Dionysos [Dionysus] rather than Theseus is the grandfather of these offspring of Ariadne, but the issue remains nonetheless, since Ariadne would first have had children only after her encounters with the young Theseus.
In The Life of Theseus 20, the people of the island of Naxos have a solution for this by saying that there were actually two different Cretan kings called Minos, each having a daughter named Ariadne. The older Ariadne was the wife of Dionysos, whose grownup grandchildren thus could reasonably have been contemporaries of Theseus and Herakles, while the younger Ariadne was Theseus' paramour.
The people of Troizenos [Troezen], the city of Argolis in which Theseus is supposed to have been born and raised, believed that Theseus was undoubtedly younger than Herakles rather than the other way around. According to Pausanias' Description of Greece 1.27.7-8, in the oldest legend of the city, Theseus had met Herakles at least by the time that he, Theseus, was seven years old. By that time, Herakles had already begun his twelve labours, which logically must be the case because the story has Herakles wearing the skin of the Nemean Lion, which he would have killed for the sake of his first labour.
About nine years later, when Theseus was sixteen years old, he performed incredible feats of strength, starting off by lifting up a huge rock under which his father Aigeus [Aegeus] had left for him a sword and a pair of sandals to find. On his way to meet his father in Athens for the first time, instead of taking the safe route, by sea, he went the dangerous way, by land, via the Isthmos [Isthmus] of Korinthos [Corinth], which path was, at the time infested with humongous notorious bandits.
Once again Plutarch shares your instinct about there being a problem to solve regarding the relative levels of renown between Theseus and Herakles. Plutarch feels the need to explain why, while Herakles is still alive, there is any need for Theseus to clear away the villains infesting the Korinthian Isthmos. At this point in time, in The Life of Theseus 6, Herakles is occupied with being a slave of Queen Omphale of Lydia far away.
Meanwhile the teenaged Theseus has been so inspired by the glorious deeds of Herakles that he deliberately sets out to become "a second Herakles". This is the reason he takes the dangerous route to Athens. By the time he reaches his father's city, Theseus has performed six great feats of power which include killing the monstrous malefactors Periphetes the Cudgeller; Sinnis the Pine-Bender; Skiron [Sciron]; and Kerkyon [Cercyon]; as well as Polypemon the Subduer. He also killed the monster Sow of Krommyon. Those six happen to be half the number of Herakles' all-famous twelve tasks.
Writing centuries before Plutarch, Hellanicus says that Theseus founded the Isthmian Games for Poseidon, who was said to be his real father, because Theseus wanted to imitate the Olympic Games that Herakles had inaugurated for his own father Zeus. As a matter of fact, for Hellanicus, Theseus did not even live in the same generation as Herakles, but was later, which is why, according to him, Theseus and Herakles did not, as is often said, go together to Themiskyra [Themiscyra], the land of the Amazons, but Theseus went on his own private expedition thereto.
In his 1995 book Theseus and Athens (Oxford University Press), Henry John Walker explains (p. 54) that the rise of the stories of Theseus as a superhuman hero practically on Herakles' level was a result of political tensions between Athens and Sparta in the sixth century BC.
Theseus had never been anything more than one of many Athenian heroes,
but after 510 B.C. he became the greatest hero of Athens, and just as
Athens would one day be able to challenge Sparta, so Theseus developed
into a worthy rival of the great Panhellenic Dorian hero, Heracles
Having said all of that, the same issue could be applied to all the other heroes who are supposed to have been contemporaneous with Herakles, although indeed none of them seems to achieve quite the same level of popularity as either Herakles or Theseus. Still, Herakles has to appear somewhere in the chronology of these myths, and at no point in the mythical timeline are things so uneventful that there isn't someone somewhere being credited with some doughty deed or another.
And so it goes that Herakles appears as one of the fifty Argonauts, led by Iason [Jason], and in the company of other names like Orpheus, Meleagros [Meleager], Peleus and the Dioskouroi [Dioscuri]. But just because the fame of Herakles eclipses all of their renown in comparison, it doesn't mean that they have absolutely none of their own or that they aren't believed to have done some incredibly amazing things themselves, often enough, together with and alongside Herakles.