Aghasura (Samskrit: अघासुरः) was the brother of Bakasura and Putana and a follower of Kamsa. Following Kamsa’s instructions, he once went to Gokula to kill Sri Krshna. At that time, Sri Krshna was playing on the banks of the river Kalindi with other gopalas. Aghasura watched the games of the children from the sky above. And in due course, transformed himself into a huge serpent and lay with his mouth wide open. His open mouth looked like an immense cave. The gopalas walked into the cave-like mouth of Agha in the course of their games. Aghasura also immediately closed his mouth as soon as Sri Krshna entered his body. Realizing the situation, Sri Krshna now enlarged his body. His body grew larger and larger until at last it burst open the body of the serpent (Agha). And thus, Aghasura was killed. Sri Krshna then restored life of the boys by his divine look (kataksha). 
कथाविस्तारः ॥ Detailed story
The story of Aghasura occurs in the 12th Chapter of the 10th Skandha of the Bhagavata Purana. The story as narrated in the Bhagavata Purana is as follows:
क्वचिद्वनाशाय मनो दधद् व्रजात् प्रातः समुत्थाय वयस्यवत्सपान् । प्रबोधयन् श्रृंगरवेण चारुणा विनिर्गतो वत्सपुरःसरो हरिः ॥ १ ॥
तेनैव साकं पृथुकाः सहस्रशः स्निग्धाः सुशिग्वेत्रविषाणवेणवः । स्वान् स्वान् सहस्रो परिसङ्ख्ययान्वितान् वत्सान् पुरस्कृत्य विनिर्ययुर्मुदा ॥ २ ॥
कृष्णवत्सैः असङ्ख्यातैः यूथीकृत्य स्ववत्सकान् । चारयन्तोऽर्भलीलाभिः विजह्रुः तत्र तत्र ह ॥ ३ ॥
अथ अघनामाभ्यपतन् महासुरः तेषां सुखक्रीडनवीक्षणाक्षमः । नित्यं यदन्तर्निजजीवितेप्सुभिः पीतामृतैः अप्यमरैः प्रतीक्ष्यते ॥ १३ ॥
दृष्ट्वार्भकान् कृष्णमुखान् अघासुरः । कंसानुशिष्टः स बकीबकानुजः । अयं तु मे सोदरनाशकृत्तयोरः द्वयोर्ममैनं सबलं हनिष्ये ॥ १४ ॥
एते यदा मत्सुहृदोस्तिलापः कृतास्तदा नष्टसमा व्रजौकसः । प्राणे गते वर्ष्मसु का नु चिन्ता प्रजासवः प्राणभृतो हि ये ते ॥ १५ ॥
इति व्यवस्याजगरं बृहद् वपुः स योजनायाम महाद्रिपीवरम् । धृत्वाद्भुतं व्यात्तगुहाननं तदा पथि व्यशेत ग्रसनाशया खलः ॥ १६ ॥
धराधरोष्ठो जलदोत्तरोष्ठो दर्याननान्तो गिरिशृङ्गदंष्ट्रः । ध्वान्तान्तरास्यो वितताध्वजिह्वः परुषानिलश्वासदवेक्षणोष्णः ॥ १७ ॥
दृष्ट्वा तं तादृशं सर्वे मत्वा वृन्दावनश्रियम् । व्यात्ताजगरतुण्डेन ह्युत्प्रेक्षन्ते स्म लीलया ॥ १८ ॥
अहो मित्राणि गदत सत्त्वकूटं पुरः स्थितम् । अस्मत्सङ्ग्रसनव्यात्त व्यालतुण्डायते न वा ॥ १९ ॥
सत्यमर्ककरारक्तं उत्तराहनुवद्घनम् । अधराहनुवद् रोधः तत् प्रतिच्छाययारुणम् ॥ २० ॥
प्रतिस्पर्धेते सृक्किभ्यां सव्यासव्ये नगोदरे । तुंगशृंगालयोऽप्येताः तद् दंष्ट्राभिश्च पश्यत ॥ २१ ॥
आस्तृतायाम मार्गोऽयं रसनां प्रतिगर्जति । एषां अन्तर्गतं ध्वान्तं एतदप्यन्तः आननम् ॥ २२ ॥
दावोष्णखरवातोऽयं श्वासवद्भाति पश्यत । तद् दग्धसत्त्वदुर्गन्धोऽपि अन्तरामिषगन्धवत् ॥ २३ ॥
अस्मान्किमत्र ग्रसिता निविष्टानयं तथा चेद् बकवद् विनङ्क्ष्यति । क्षणादनेनेति बकार्युशन्मुखं वीक्ष्योद्धसन्तः करताडनैर्ययुः ॥ २४ ॥
इत्थं मिथोऽतथ्यं अतज्ज्ञभाषितं श्रुत्वा विचिन्त्येत्यमृषा मृषायते । रक्षो विदित्वाखिल-भूतहृत्स्थितः स्वानां निरोद्धुं भगवान् मनो दधे ॥ २५ ॥
तावत् प्रविष्टास्तु असुरोदरान्तरं परं न गीर्णाः शिशवः सवत्साः । प्रतीक्षमाणेन बकारिवेशनं हतस्वकान्तस्मरणेन रक्षसा ॥ २६ ॥
तान् वीक्ष्य कृष्णः सकलाभयप्रदो ह्यनन्यनाथान् स्वकरादवच्युतान् । दीनांश्च मृत्योर्जठराग्निघासान् घृणार्दितो दिष्टकृतेन विस्मितः ॥ २७ ॥
कृत्यं किमत्रास्य खलस्य जीवनं न वा अमीषां च सतां विहिंसनम् । द्वयं कथं स्यादिति संविचिन्त्य तत् ज्ञात्वाविशत् तुण्डमशेषदृग्घरिः ॥ २८ ॥
तदा घनच्छदा देवा भयाद् हाहेति चुक्रुशुः । जहृषुर्ये च कंसाद्याः कौणपास्त्वघबान्धवाः ॥ २९ ॥
तच्छ्रुत्वा भगवान् कृष्णस्तु अव्ययः सार्भवत्सकम् । चूर्णीचिकीर्षोरात्मानं तरसा ववृधे गले ॥ ३० ॥
ततोऽतिकायस्य निरुद्धमार्गिणो ह्युद्गीर्णदृष्टेः भ्रमतस्त्वितस्ततः । पूर्णोऽन्तरंगे पवनो निरुद्धो मूर्धन् विनिष्पाट्य विनिर्गतो बहिः ॥ ३१ ॥
तेनैव सर्वेषु बहिर्गतेषु प्राणेषु वत्सान् सुहृदः परेतान् । दृष्ट्या स्वयोत्थाप्य तदन्वितः पुनः वक्त्रान् मुकुन्दो भगवान् विनिर्ययौ ॥ ३२ ॥
पीनाहिभोगोत्थितमद्भुतं महत् ज्योतिः स्वधाम्ना ज्वलयद् दिशो दश । प्रतीक्ष्य खेऽवस्थितमीशनिर्गमं विवेश तस्मिन् मिषतां दिवौकसाम् ॥ ३३ ॥
ततोऽतिहृष्टाः स्वकृतोऽकृतार्हणं पुष्पैः सुगा अप्सरसश्च नर्तनैः । गीतैः सुरा वाद्यधराश्च वाद्यकैः स्तवैश्च विप्रा जयनिःस्वनैर्गणाः ॥ ३४ ॥
तदद्भुतस्तोत्रसुवाद्यगीतिका जयादिनैकोत्सव मङ्गलस्वनान् । श्रुत्वा स्वधाम्नोऽन्त्यज आगतोऽचिराद् दृष्ट्वा महीशस्य जगाम विस्मयम् ॥ ३५ ॥
राजन् आजगरं चर्म शुष्कं वृन्दावनेऽद्भुतम् । व्रजौकसां बहुतिथं बभूवाक्रीडगह्वरम् ॥ ३६ ॥
एतत्कौमारजं कर्म हरेरात्माहिमोक्षणम् । मृत्योः पौगण्डके बाला दृष्ट्वोचुर्विस्मिता व्रजे ॥ ३७ ॥
नैतद् विचित्रं मनुजार्भमायिनः परावराणां परमस्य वेधसः । अघोऽपि यत्स्पर्शनधौतपातकः प्रापात्मसाम्यं त्वसतां सुदुर्लभम् ॥ ३८ ॥
सकृद्यदङ्गप्रतिमान्तराहिता मनोमयी भागवतीं ददौ गतिम् । स एव नित्यात्मसुखानुभूत्यभि व्युदस्तमायोऽन्तर्गतो हि किं पुनः ॥ ३९ ॥
kvacidvanāśāya mano dadhad vrajāt prātaḥ samutthāya vayasyavatsapān । prabodhayan śrr̥ṁgaraveṇa cāruṇā vinirgato vatsapuraḥsaro hariḥ ॥ 1 ॥
tenaiva sākaṁ pr̥thukāḥ sahasraśaḥ snigdhāḥ suśigvetraviṣāṇaveṇavaḥ । svān svān sahasro parisaṅkhyayānvitān vatsān puraskr̥tya viniryayurmudā ॥ 2 ॥
kr̥ṣṇavatsaiḥ asaṅkhyātaiḥ yūthīkr̥tya svavatsakān । cārayanto'rbhalīlābhiḥ vijahruḥ tatra tatra ha ॥ 3 ॥
atha aghanāmābhyapatan mahāsuraḥ teṣāṁ sukhakrīḍanavīkṣaṇākṣamaḥ । nityaṁ yadantarnijajīvitepsubhiḥ pītāmr̥taiḥ apyamaraiḥ pratīkṣyate ॥ 13 ॥
dr̥ṣṭvārbhakān kr̥ṣṇamukhān aghāsuraḥ । kaṁsānuśiṣṭaḥ sa bakībakānujaḥ । ayaṁ tu me sodaranāśakr̥ttayoraḥ dvayormamainaṁ sabalaṁ haniṣye ॥ 14 ॥
ete yadā matsuhr̥dostilāpaḥ kr̥tāstadā naṣṭasamā vrajaukasaḥ । prāṇe gate varṣmasu kā nu cintā prajāsavaḥ prāṇabhr̥to hi ye te ॥ 15 ॥
iti vyavasyājagaraṁ br̥had vapuḥ sa yojanāyāma mahādripīvaram । dhr̥tvādbhutaṁ vyāttaguhānanaṁ tadā pathi vyaśeta grasanāśayā khalaḥ ॥ 16 ॥
dharādharoṣṭho jaladottaroṣṭho daryānanānto giriśr̥ṅgadaṁṣṭraḥ । dhvāntāntarāsyo vitatādhvajihvaḥ paruṣānilaśvāsadavekṣaṇoṣṇaḥ ॥ 17 ॥
dr̥ṣṭvā taṁ tādr̥śaṁ sarve matvā vr̥ndāvanaśriyam । vyāttājagaratuṇḍena hyutprekṣante sma līlayā ॥ 18 ॥
aho mitrāṇi gadata sattvakūṭaṁ puraḥ sthitam । asmatsaṅgrasanavyātta vyālatuṇḍāyate na vā ॥ 19 ॥
satyamarkakarāraktaṁ uttarāhanuvadghanam । adharāhanuvad rodhaḥ tat praticchāyayāruṇam ॥ 20 ॥
pratispardhete sr̥kkibhyāṁ savyāsavye nagodare । tuṁgaśr̥ṁgālayo'pyetāḥ tad daṁṣṭrābhiśca paśyata ॥ 21 ॥
āstr̥tāyāma mārgo'yaṁ rasanāṁ pratigarjati । eṣāṁ antargataṁ dhvāntaṁ etadapyantaḥ ānanam ॥ 22 ॥
dāvoṣṇakharavāto'yaṁ śvāsavadbhāti paśyata । tad dagdhasattvadurgandho'pi antarāmiṣagandhavat ॥ 23 ॥
asmānkimatra grasitā niviṣṭānayaṁ tathā ced bakavad vinaṅkṣyati । kṣaṇādaneneti bakāryuśanmukhaṁ vīkṣyoddhasantaḥ karatāḍanairyayuḥ ॥ 24 ॥
itthaṁ mitho'tathyaṁ atajjñabhāṣitaṁ śrutvā vicintyetyamr̥ṣā mr̥ṣāyate । rakṣo viditvākhila-bhūtahr̥tsthitaḥ svānāṁ niroddhuṁ bhagavān mano dadhe ॥ 25 ॥
tāvat praviṣṭāstu asurodarāntaraṁ paraṁ na gīrṇāḥ śiśavaḥ savatsāḥ । pratīkṣamāṇena bakāriveśanaṁ hatasvakāntasmaraṇena rakṣasā ॥ 26 ॥
tān vīkṣya kr̥ṣṇaḥ sakalābhayaprado hyananyanāthān svakarādavacyutān । dīnāṁśca mr̥tyorjaṭharāgnighāsān ghr̥ṇārdito diṣṭakr̥tena vismitaḥ ॥ 27 ॥
kr̥tyaṁ kimatrāsya khalasya jīvanaṁ na vā amīṣāṁ ca satāṁ vihiṁsanam । dvayaṁ kathaṁ syāditi saṁvicintya tat jñātvāviśat tuṇḍamaśeṣadr̥gghariḥ ॥ 28 ॥
tadā ghanacchadā devā bhayād hāheti cukruśuḥ । jahr̥ṣurye ca kaṁsādyāḥ kauṇapāstvaghabāndhavāḥ ॥ 29 ॥
tacchrutvā bhagavān kr̥ṣṇastu avyayaḥ sārbhavatsakam । cūrṇīcikīrṣorātmānaṁ tarasā vavr̥dhe gale ॥ 30 ॥
tato'tikāyasya niruddhamārgiṇo hyudgīrṇadr̥ṣṭeḥ bhramatastvitastataḥ । pūrṇo'ntaraṁge pavano niruddho mūrdhan viniṣpāṭya vinirgato bahiḥ ॥ 31 ॥
tenaiva sarveṣu bahirgateṣu prāṇeṣu vatsān suhr̥daḥ paretān । dr̥ṣṭyā svayotthāpya tadanvitaḥ punaḥ vaktrān mukundo bhagavān viniryayau ॥ 32 ॥
pīnāhibhogotthitamadbhutaṁ mahat jyotiḥ svadhāmnā jvalayad diśo daśa । pratīkṣya khe'vasthitamīśanirgamaṁ viveśa tasmin miṣatāṁ divaukasām ॥ 33 ॥
tato'tihr̥ṣṭāḥ svakr̥to'kr̥tārhaṇaṁ puṣpaiḥ sugā apsarasaśca nartanaiḥ । gītaiḥ surā vādyadharāśca vādyakaiḥ stavaiśca viprā jayaniḥsvanairgaṇāḥ ॥ 34 ॥
tadadbhutastotrasuvādyagītikā jayādinaikotsava maṅgalasvanān । śrutvā svadhāmno'ntyaja āgato'cirād dr̥ṣṭvā mahīśasya jagāma vismayam ॥ 35 ॥
rājan ājagaraṁ carma śuṣkaṁ vr̥ndāvane'dbhutam । vrajaukasāṁ bahutithaṁ babhūvākrīḍagahvaram ॥ 36 ॥
etatkaumārajaṁ karma harerātmāhimokṣaṇam । mr̥tyoḥ paugaṇḍake bālā dr̥ṣṭvocurvismitā vraje ॥ 37 ॥
naitad vicitraṁ manujārbhamāyinaḥ parāvarāṇāṁ paramasya vedhasaḥ । agho'pi yatsparśanadhautapātakaḥ prāpātmasāmyaṁ tvasatāṁ sudurlabham ॥ 38 ॥
sakr̥dyadaṅgapratimāntarāhitā manomayī bhāgavatīṁ dadau gatim । sa eva nityātmasukhānubhūtyabhi vyudastamāyo'ntargato hi kiṁ punaḥ ॥ 39 ॥
One day, intending to have his first meal in the forest, Sri Hari got up early in the morning and woke up his fellow cowherd boys by the charming sound of his horn, and then proceeded from Vraja driving their groups of calves in front of them. Immediately, at Krshna's call, thousands of affectionate young boys simultaneously rushed forth joyfully equipping themselves with their slings, sticks, horns and flutes, each driving his own herd of thousands of calves. Making their own calves join the herd of innumerable calves of Krshna and grazing them, they diverted themselves in children's games at various places. Then a powerful demon named Agha who could not tolerate the sight of their happy pastimes appeared there whose life's end was awaited by all the immortals despite of their drinking the nectar. Seeing the Gopa children, of whom Krshna was the leader, the demon Agha, younger brother of Baki (Putana) and Baka, who was deputed by Kamsa (to kill Krshna) said to himself, 'This must be the killer of my brother and sister. To avenge them both, I shall now kill Krshna along with his army of cowherd boys. And when these boys are killed (and thus are made as if the propitiatory libations of sesame seeds and water to my departed brother and sister), all the residents of Vraja will be as good as dead (as the strength of their life, their children, have disappeared).
Having decided thus, he assumed a gigantic body of a very large python that extended for one yojana (8 miles) in length and was stout like a big mountain and with a desire to swallow them all, he lay motionless on their path, with his astonishing cavelike mouth kept wide open. His lower lip rested on the earth and his upper lip touched the sky; the mouth between them appeared like a valley; his fangs were like summits of mountains, and the interior part of his mouth was full of darkness; his tongue resembled a broad road, his breath was like a warm wind and his enraged red hot eyes were like a forest conflagration. Seeing him in that form, they all (the gopas) considered it as a beautiful landscape of Vrndavana. And in a sportive mood they fancied its semblance to the open mouth of a python.
The children then began to talk about it as follows:
'Tell friends! if this animal like formation (of mountain) standing before us, does or does not resemble the open mouth of a gigantic wicked serpent anxious to devour us all ?
Really, the cloud reddened with rays of the sun looks like his upper lip, while the earth grown red through the reflection (of the cloud) looks like the lower lip.
Look ! The mountain caves on its right as well as left, are as if competing with the jaws; and the rows of lofty mountain summits are exactly like the animal's teeth.
The broad and long road is vying with its tongue while the darkness pent up in between the peaks, emulates the darkness in the internal part of its mouth.
Look here ! The fierce blast of wind heated by forest fire feels like its breath, and the bad odour of animals burnt in that forest fire stinks like the flesh of animals in the stomach of a serpent.
Will he swallow us all if we enter his mouth ? In that case, like Bakasura, he will meet his death in a moment at the hands of Krshna.
Saying so, and looking at the fascinating face of Krshna, the slayer of Baka, they all entered (that mouth) laughing loudly and clapping their hands.
However, hearing the mutual discussion, which was far removed from reality, of his friends who were ignorant of the factual state of things, Krshna knew that that was really a demon simulating the form of a serpent, as the Lord is present in the hearts of all creatures. The Lord made up his mind to prevent his companions from entering the demon's mouth. Meanwhile, all the boys and their calves had entered the belly of the demon, but they were not devoured by that rakshasa who remembered the slaying of his dear ones and was expecting the entry of the slayer of Baka ie. Krshna. Lord Krshna, who affords protection to all, was moved with compassion to see the helpless children and calves who had no other saviour, and who having slipped out of (the protective control of) his hands, had become the victims of the gastric fire of the demon. He was surprised at the working of fate. What should be done now ? How can both the objectives of terminating the life of this wicked demon and averting the death of these pious innocents, be achieved ? Gathering His thoughts and knowing what to do, the omniscient Hari entered the mouth (of Aghasura).
At that very moment, all the deities exclaimed from behind the clouds in fear 'Alas, alas!' while Kamsa and the other demonic friends of Aghasura rejoiced. When He heard that, the imperishable glorious Lord Krshna, immediately expanded Himself in huge dimensions within the throat of the demon who tried to crush to powder Krshna along with children and calves. With that action, all the airways of that huge bodied demon were blocked and the eyes popped out of their sockets. He was writhing on all sides. His breath completely obstructed in his lungs, forced its way out through an opening on the head called Brahma randhra. After all the vital breaths of the demon had left the body, Lord Krshna revived to life with his nectarine look, all his friends and calves who were as good as dead and came out of the mouth of the demon again, along with them. From the huge body of the serpent, a most wonderful bright light issued that all by itself illumined the ten directions. It remained in the sky waiting until the Lord came out (from the serpent's mouth) and then, before the eyes of the celestials, entered His body.
Overjoyed at the accomplishment of their purpose by Krshna, the jubiliant deities offered their worship by showering flowers, the apsaras through dancing, gandharvas, experts in vocal music, with singing, those well-versed in instrumental music by playing on their instruments, brahmanas like Narada through singing of hymns of praise and His attendants and followers like Garuda and others with shouts of victory. Lord Brahma, who nearby in his abode heard the auspicious and joyous sounds of those wonderful hymns of praise, instrumental music, vocal music and shouts of victory, immediately came and stood wonder struck at the glorious feat of the Lord. In fact, after the skin of the python had dried, it served for a long time as a hiding place in playing (like a big cave) to the residents of Vraja. And this incident - of the snake's death and deliverance and the liberation of him and his associates - that took place when the Lord was five years old, was by the boys in Vraja disclosed one year later also as if it had happened that very day.
However unthinkable it might be that even a demon like Agha should get his papa absolved by his touch and should get absorbed in him, it is not that astonishing as in this case it is Hari who has assumed through his maya the form of a human child but who is really the creator of all beings, great and small. This destination He even grants to those who but once install in one's heart in meditation the personality of the Lord. What indeed would he not give to Aghasura in whom he actually entered, as he had warded off maya by the eternal realisation of the bliss of his divine Self.