Soon after Babur's death, his successor, Humayun, was in AD 1540 supplanted by the Pathan Sher Shah, who, in AD 1545, was followed by Islam Shah. During the reign of the latter a battle was fought and lost by the Emperor's troops at Firozpur Jhirka, in Mewat, on which, however, Islam Shah did not loose his hold. Adil Shah, the third of the Pathan interlopers, who succeeded in AD 1552, had to contend for the Empire with the returned Humayun.
In these struggles for the restoration of Babar's dynasty Khanzadas apparently do not figure at all. Humayun seems to have conciliated them by marrying the elder daughter of Jamal Khan, nephew of Babar's opponent, Hasan Khan, and by causing his great minister, Bairam Khan, to marry a younger daughter of the same Mewatti.
When Humayun came to the throne of the Mughal Empire, several of his brothers revolted against him. Another brother Khalil Mirza (1509–30) supported Humayun but was assassinated. The Emperor commenced construction of a tomb for his brother in 1538, but this was not yet finished when Humayun was forced to flee to Persia. Sher Shah destroyed the structure and no further work was done on it after Humayun's restoration.
In December 1530, Humayun succeeded his father to the throne of Farghana as ruler of the Mughal territories in the Indian subcontinent. At the age of 23, Humayun was an inexperienced ruler when he came to power. His half-brother Kamran Mirza inherited Kabul and Lahore, the northernmost parts of their father's empire. Mirza was to become a bitter rival of Humayun.
In 1535 Humayun was made aware that the Sultan of Gujarat was planning an assault on the Mughal territories with Portuguese aid. Humayun gathered an army and marched on Bahadur. Within a month he had captured the forts of Mandu and Champaner. However, instead of pressing his attack, Humayun ceased the campaign and consolidated his newly conquered territory. Sultan Bahadur, meanwhile escaped and took up refuge with the Portuguese.
Shortly after Humayun had marched on Gujarat, Sher Shah Suri saw an opportunity to wrest control of Agra from the Mughals. He began to gather his army together hoping for a rapid and decisive siege of the Mughal capital. Upon hearing this alarming news, Humayun quickly marched his troops back to Agra allowing Bahadur to easily regain control of the territories Humayun had recently taken. In February 1537, however, Bahadur was killed when a botched plan to kidnap the Portuguese viceroy ended in a fire-fight that the Sultan lost.
In June 1539 Sher Shah met Humayun in the Battle of Chausa on the banks of the Ganges, near Buxar. This was to become an entrenched battle in which both sides spent a lot of time digging themselves into positions. The major part of the Mughal army, the artillery, was now immobile, and Humayun decided to engage in some diplomacy using Muhammad Aziz as ambassador. Humayun agreed to allow Sher Shah to rule over Bengal and Bihar, but only as provinces granted to him by his Emperor, Humayun, falling short of outright sovereignty. The two rulers also struck a bargain in order to save face: Humayun's troops would charge those of Sher Shah whose forces then retreat in feigned fear. Thus honour would, supposedly, be satisfied.
When Kamran returned to Lahore, his troops followed him shortly afterwards, and Humayun, with his other brothers Askari and Hindal, marched to meet Sher Shah just 240 kilometres (150 mi) east of Agra at the battle of Kannauj on 17 May 1540. Humayun once again made some tactical errors, and his army was soundly defeated. He and his brothers quickly retreated back to Agra, but they chose not to stay and retreated to Lahore, since Sher Shah followed them. The founding of the short-lived Sur Dynasty (which contained only him and his son) of northern India, with its capital at Delhi, resulted in Humayun's exile for 15 years in the court of Shah Tahmasp I.
Bairam Khan led the army through the Punjab virtually unopposed. The fort of Rohtas, which was built in 1541–43 by Sher Shah Suri to crush the Gakhars who were loyal to Humayun, was surrendered without a shot by a treacherous commander. The walls of the Rohtas Fort measure up to 12.5 meters in thickness and up to 18.28 meters in height. They extend for 4 km and feature 68 semi-circular bastions. Its sandstone gates, both massive and ornate, are thought to have exerted a profound influence on Mughal military architecture.
Rana Prasad Rao of Amarkot duly welcomed Humayun into his home and sheltered the refugees for several months. Here, in the household of a Hindu Rajput nobleman, Humayun's wife Hamida Bano, daughter of a Sindhi family, gave birth to the Future Emperor Akbar on 15 October 1542. The date of birth is well established because Humayun consulted his Astronomer to utilise the astrolabe and check the location of the planets. The infant was the long-awaited heir-apparent to the 34-year-old Humayun and the answer of many prayers. Shortly after the birth, Humayun and his party left Amarkot for Sindh, leaving Hamida and her child in the custody of their Hindu hosts. A couple of years later, at Humayun's behest, Hamida would leave her infant son in the safety of remote Amarkot and join her husband as he fled into Persia. The infant Akbar was to live for more than five years, all alone, in the care of a Hindu, Rajput foster-family. This was to have a profound, indelible influence on his views and personality, and a momentous effect on the subsequent history of India. In particular, Akbar developed a strong affinity for the Rajputs, going out of his way to forge alliances (including marriage alliances) with them, and they would form the bedrock of support for his dynasty for two centuries.
After Humayun set out from his expedition in Sindh, along with 300 camels (mostly wild) and 2000 loads of grain, he set off to join his brothers in Kandahar after crossing the Indus River on 11 July 1543 along with the ambition to regain the Mughal Empire and overthrow the Suri dynasty. Among the tribes that had sworn allegiance to Humayun were the Magsi, Rind and many others.
Sher Shah Suri had died in 1545; his son and successor Islam Shah died in 1554. These two deaths left the dynasty reeling and disintegrating. Three rivals for the throne all marched on Delhi, while in many cities Leaders tried to stake a claim for independence. This was a perfect opportunity for the Mughals to march back to India.
Humayun's other brother, Kamran Mirza, had repeatedly sought to have Humayun killed. In 1552 Kamran Mirza attempted to make a pact with Islam Shah, Sher Shah's successor, but was apprehended by a Gakhar. The Gakhars were one of the minority of tribal groups who had consistently remained loyal to their oath to the Mughals. Sultan Adam of the Gakhars handed Kamran Mirza over to Humayun. Humayun was inclined to forgive his brother. However he was warned that allowing Kamran Mirza's repeated acts of treachery to go unpunished could foment rebellion amongst his own supporters. So, instead of killing his brother, Humayun had Kamran Mirza blinded which would end any claim by the latter to the throne. Humayun sent Kamran Mirza on Hajj, as he hoped to see his brother thereby absolved of his offences. However Kamran Mirza died close to Mecca in the Arabian Peninsula in 1557.
After Sirhind, most towns and villages chose to welcome the invading army as it made its way to the capital. On 23 July 1555, Humayun once again sat on Babur's throne in Delhi.
On 27 January 1556, Humayun, with his arms full of books, was descending the staircase from his library when the muezzin announced the Azaan (the call to prayer). It was his habit, wherever he heard the summons, to bow his knee in holy reverence. Trying to kneel, he caught his foot in his robe, tumbled down several steps and hit his temple on a rugged stone edge. He died three days later. His body was laid to rest in Purana Quila initially, but, because of an attack by Hemu on Delhi and the capture of Purana Qila, Humayun's body was exhumed by the fleeing army and transferred to Kalanaur in Punjab where Akbar was crowned. His tomb, which was commissioned by his favourite and devoted chief wife, Bega Begum, stands in Delhi, where he was later buried in a grand way.
Subsequently, Humayun further expanded the Empire in a very short time, leaving a substantial legacy for his son, Akbar. His peaceful personality, patience and non-provocative methods of speech earned him the title ’Insān-i-Kamil (Perfect Man), among the Mughals.