A mattress-retention mechanism is provided that prevents a mattress from moving on an adjustable bed during articulation. The mechanism includes a rod held between two retainer ends. The rod is held on the mattress bottom within a tube. The retainer ends have a downwardly extending leg that passes through a corresponding hole in the bed base. Each leg has a toothed rack that can be engaged by a latch. Each retainer end is held in place by a latch assembly coupled to the bottom of the adjustable bed base. The latch assembly has a retainer block that holds a latch, and a biasing mechanism. The biasing mechanism operates to move the latch into engagement with the leg of the retainer end. The mechanism maintains the mattress in place relative to the adjustable bed base, while being hidden from view.