We used 'lee cloths' on our boat to keep people in their berth during heavy weather at sea. They are pretty simple to make.
1. Make a piece of canvas nearly as long as the bed and a foot or so high. Install a number of grommets along one of the long edges of the canvas.
2. Install some hooks on the overhead corresponding to the grommets in the canvas.
3. Attach the canvas to the plywood under the bed with a row of screws, near the edge of the bed, but so that the canvas can lay under the cushion when not being used.
4. Lace the grommets to the hooks overhead.
You can leave a little room at the foot end for ingress/egress.
Another alternative is to use a board that fits in a slot at each end of the bed.
Steve & C. J.
2009 Arctic Fox 29V PullRite 20K hitch
2005 Chevy Silverado 2500HD 4X4 Duramax/Allison