diff --git a/src/dehacked.c b/src/dehacked.c
index 32b01a652bc36cbf46d5bff44a004bc16e28924a..53bd3dc03def694030be593ac9823ed87eaa059f 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -1172,6 +1172,15 @@ static void readlevelheader(MYFILE *f, INT32 num)
 			else if (fastcmp(word, "MUSICINTER"))
 				deh_strlcpy(mapheaderinfo[num-1]->musintername, word2,
 					sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num));
+			else if (fastcmp(word, "MUSICPOSTBOSS"))
+				deh_strlcpy(mapheaderinfo[num-1]->muspostbossname, word2,
+					sizeof(mapheaderinfo[num-1]->muspostbossname), va("Level header %d: post-boss music", num));
+			else if (fastcmp(word, "MUSICPOSTBOSSTRACK"))
+				mapheaderinfo[num-1]->muspostbosstrack = ((UINT16)i - 1);
+			else if (fastcmp(word, "MUSICPOSTBOSSPOS"))
+				mapheaderinfo[num-1]->muspostbosspos = (UINT32)get_number(word2);
+			else if (fastcmp(word, "MUSICPOSTBOSSFADEIN"))
+				mapheaderinfo[num-1]->muspostbossfadein = (UINT32)get_number(word2);
 			else if (fastcmp(word, "FORCECHARACTER"))
 			{
 				strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1);
diff --git a/src/doomstat.h b/src/doomstat.h
index 18300967c1231de7de860afcc54690e2a2d72271..b6c376d1ce46ebea5bf83b86010110f98aaba201 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -327,6 +327,11 @@ typedef struct
 	// Music stuff.
 	UINT32 musinterfadeout;  ///< Fade out level music on intermission screen in milliseconds
 	char musintername[7];    ///< Intermission screen music.
+	
+	char muspostbossname[7];    ///< Post-bossdeath music.
+	UINT16 muspostbosstrack;    ///< Post-bossdeath track.
+	UINT32 muspostbosspos;      ///< Post-bossdeath position
+	UINT32 muspostbossfadein;   ///< Post-bossdeath fade-in milliseconds.
 
 	// Lua stuff.
 	// (This is not ifdeffed so the map header structure can stay identical, just in case.)
diff --git a/src/lua_maplib.c b/src/lua_maplib.c
index 82843db4ee768a129f23e82e728d00964ffdcdde..74b2599219bc203f39352632eb2c2985a04eb4e7 100644
--- a/src/lua_maplib.c
+++ b/src/lua_maplib.c
@@ -2009,6 +2009,14 @@ static int mapheaderinfo_get(lua_State *L)
 		lua_pushinteger(L, header->musinterfadeout);
 	else if (fastcmp(field,"musintername"))
 		lua_pushstring(L, header->musintername);
+	else if (fastcmp(field,"muspostbossname"))
+		lua_pushstring(L, header->muspostbossname);
+	else if (fastcmp(field,"muspostbosstrack"))
+		lua_pushinteger(L, header->muspostbosstrack);
+	else if (fastcmp(field,"muspostbosspos"))
+		lua_pushinteger(L, header->muspostbosspos);
+	else if (fastcmp(field,"muspostbossfadein"))
+		lua_pushinteger(L, header->muspostbossfadein);
 	else if (fastcmp(field,"forcecharacter"))
 		lua_pushstring(L, header->forcecharacter);
 	else if (fastcmp(field,"weather"))
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 782323226c917b9617fa0428933dede2b8d52f50..3e7431e4068d54650e47ea6fae0a76cb2fcea5d1 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -3812,6 +3812,24 @@ void A_BossDeath(mobj_t *mo)
 		EV_DoElevator(&junk, elevateUp, false);
 		junk.tag = LE_CAPSULE2;
 		EV_DoElevator(&junk, elevateHighest, false);
+
+		if (mapheaderinfo[gamemap-1]->muspostbossname[0] &&
+			S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled))
+		{
+			// Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic.
+			// So just park ourselves in the mapmus variables.
+			boolean changed = strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7);
+			strncpy(mapmusname, mapheaderinfo[gamemap-1]->muspostbossname, 7);
+			mapmusname[6] = 0;
+			mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET;
+			mapmusposition = mapheaderinfo[gamemap-1]->muspostbosspos;
+
+			// don't change if we're in another tune
+			// but in case we're in jingle, use our parked mapmus variables so the correct track restores
+			if (!changed)
+				S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2),
+					mapheaderinfo[gamemap-1]->muspostbossfadein);
+		}
 	}
 
 bossjustdie:
diff --git a/src/p_setup.c b/src/p_setup.c
index a089e0a8f2292751ac0e69d520d1d93d8ecd4e01..b7d53349b79d4c65dc23215da2f352bec19afd19 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -217,6 +217,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
 	mapheaderinfo[num]->muspos = 0;
 	mapheaderinfo[num]->musinterfadeout = 0;
 	mapheaderinfo[num]->musintername[0] = '\0';
+	mapheaderinfo[num]->muspostbossname[6] = 0;
+	mapheaderinfo[num]->muspostbosstrack = 0;
+	mapheaderinfo[num]->muspostbosspos = 0;
+	mapheaderinfo[num]->muspostbossfadein = 0;
 	mapheaderinfo[num]->forcecharacter[0] = '\0';
 	mapheaderinfo[num]->weather = 0;
 	mapheaderinfo[num]->skynum = 1;