How can you be immune to damage from bed explosions in the nether/end?
In order to survive, you are supposed to place a block in front of the bed and click it as far away as possible (around 5 blocks), without being positioned right beside the block in front of the bed. This is so the block will take the main explosive damage of the bed, not the player. Additionally, try to use a block with high blast resistance, such as obsidian, as it will absorb more damage than a block such as wood. A bed explosion in the Nether or the End is the second most powerful explosion possible. It is as powerful as a charged creeper (which does 97 damage points on normal mode) and is much more powerful than TNT.
Source: I have done many experiments on this.