Duke Kestutis, pagan Duke of Trakai, brother and close ally to Grand Duke Algirdas of Lithuania escaped from Marienburg, where he was held by the Teutonic Order 1361.
Being an important nobleman and someone the Teutonic Order hoped to convert to christianity, Kestutis was kept in relative comfort and not in cell far down the dungeon. Still, his escape was, according to German chronicler Wigand of Marburg, quite daring and quite demanding.
Kestutis, who was supposedly 65 at the time, but in fine physical shape (he would go on to lead Lithuanian military campaigns 1363 and 1370, the latter at the age of 74), escaped from his cell or room through a locked door, climbed up through a chimney, stole a Teutonic Knight's cloak/mantle and simply went out in the courtyard, mounted the Grand Master's own horse and rode out of Marienburg (which was the largest and strongest castle in Europe) like no-one's business.
Maybe not completely what you are looking for, but in 1618, just after the middle ages, Hugo Grotius, a member of the States General, the government of the Dutch Republic was among those imprisoned by the Remonstrants, who staged a coup and overthrew the States General.
Grotius had it fairly well in his prison, he was allowed to write, correspond with outsiders and had access to books, but he was scared the authorities would revisit his case and impose a harsher punishment, they had executed some other members. So he decided to escape.
In March 1621, his wife shipped a large chest to him. He then had it sent away, pretending it contained books. In reality, he hid in it and had himself shipped away. The escape attempt was succesful and he fled via Antwerp to Paris where he rejoined his family.
This escape attempt is fairly famous in The Netherlands and you won't find many people who don't know about the bookcase of "Hugo de Groot", as he is known there.
Not a "prison escape" as such but he was a prisoner at the time...
King Henry III of England was facing a rebellion led by Simon de Montfort, the Earl of Leicester, Henry's own brother-in-law. The king had become unpopular with the baronial class due to his costly building projects (most notably the construction of Westminster Abbey as we know it today) and an unsuccessful attempt to intervene on the Pope's behalf in Sicily. The rebellious barons also opposed the influence over the king, both actual and perceived, that certain "foreigners" had. I'm not quite sure what constituted a "foreigner" in the mid-13th century, as de Montfort himself was French-born and never set foot on English soil, that I know of, until he was over 20 years old.
Anyways!
Prince Edward (would later become King Edward I of England, or Edward Longshanks) was taken as a hostage after the royalist defeat at Lewes in order to ensure that Henry III abided by de Montfort and the barons' demands.
From the admittedly little I've read (I'm going off of Simon Schama's A History of Britain, 3000BC-1603AD, I've just read up to Edward's coronation), it sounds like his imprisonment was pretty lax, and he was allowed visits from friends and learnt of the movements of royalist armies (de Montfort still had plenty of enemies, even with the king defeated and the prince a prisoner).
So Edward was out on a hunting trip, under the supervision of his captors. He asked to inspect their horses and proceeded to run them into the ground, exhausted. After tiring out all the horses but one, he took the last one and fled to freedom.
Just five months later, in August 1265, Edward defeated de Montfort's army at Evesham. With de Montfort killed in the course of battle, the leader of the civil war was dead and much of the opposition to the king and prince disintegrated.
I think this question is premised on a misconception; the idea that something analogous to modern prisons existed in the middle ages. The governments of the various kingdoms, towns, etc. in the middle ages would be much less centralized and generally much less powerful than our modern national, state, and local institutions. Local law enforcement would generally have been handled by local volunteers at the manorial level, and by a sheriff or similar official appointed or approved by the king at the shire or county level.
With the number and resources of local law enforcement being limited, there was no money or staff to run a prison that would hold someone for years at a time. A large town or castle would likely have some cells, but these would function as a jail. That is, it would be a temporary place to hold a prisoner before sentencing was carried out; not somewhere to hold someone as their punishment. The average punishment for minor crimes in the middle ages would involve some form of public shaming or financial punishment; time in the stocks, a fine, or restitution to the victim. For more serious crimes, the offender might be branded as a thief, have their hand cut off, or be whipped or flogged. For the most serious crimes, the death penalty was most common.
The thread that ties all these punishments together is that they could be performed immediately following trial, and at little cost in time and money. You would capture the criminal, sentence them, flog them (for example), and then let them go on their way. No costly business of maintaining a roof over their head, feeding them, guarding them, etc. The modern conception of a prison, a large building that people are sentenced to live at for years at a time as their punishment, would not start to be common until the late 1700s.
I don't have detailed sources nearby, but Sir Thomas Malory, author of the deservedly famous Le Morte d'Arthur, was in and out of prison for much of his life. Not terribly surprising that he'd be put in in the first place, given that he was a politically active man during the Wars of the Roses, but he did do rather more escaping than your average medieval prisoner. If I recall correctly, he even swam across a moat in one of his escapes. Luckily for posterity, he eventually found himself in the Tower of London, a prison both escape-proof and well stocked with books. It was there that he wrote his magnum opus.
I hope someone with more knowledge can verify and add to this, but didn't Napoleon escape exile, return to France, gain power, and attempt to take over Europe again?