For the sturdiest fix simply screw one or more 2 inch thick.
How to fill gap between mattress and bed frame.
Bamboo bed bridge twin to king converter kit wide bed gap filler to make twin beds into king adjustable 2 inch wide mattress connecting strap and 4 bed sheets fasteners storage bag included 4 1 out of 5 stars 138.
To make a cover for storage.
Push the frame back against the headboard.
Place the structure between the mattress and the foot board and enjoy.
Then attach the right half to the left half using either pocket hole screws or angle brackets.
Then use the area for under bed storage boxes and cover with a board and put a handle on it.
Cover it with fabric or an old quilt or sheet.
Block the gap when a new mattress is just not in the budget consider bridging the gap at least until you can afford a new mattress.
Put the pillows on that area which now makes the bed longer.
Or get a board and put it at the bottom to stop the mattress from moving.
Secure the two longer pieces to the remaining short piece with 2 1 2 wood screws.