How to frame an outlet between studs
A simple 2x6 horizontally across the stud bay is all that is needed,
2 screws  from the back of the box into the 2x6.
Remember if in the center and no clamps NMB needs to be stapled within 8”
Make sure to set the back cross beam or horizontal box hanger so your box will protrude ~1/2” beyond the face of the stud I have seen DIY’s forget this step and the inspector flagged them on the cover inspection.
They did not know what to do but a box extension in all of there locations worked fine.  It was good they called a 1$ Fix per box (I fixed the big stuff he flagged).
It can be done with a single 2x4 but they are not as solid as a 2x6.