We nailed a 2 × 4 to the wall (
running vertically) anchored to the wall stud and a 2 × 4 (also
running vertically) nailed to the side of the bookcase, then nailed a 1x
board to the front to cover those two 2x4s so it would be completely anchored to the wall and bookcase and fill that gap on that side.