You need to drill three operations.
- The 2x4 piece being fastened. It needs a clearance hole drilled all the way through that allows that #9 sized screw to drop in. So the hole diameter needs to be just large enough as the greatest outside diameter of the screw. That may be the threaded part or the non-threaded part could be larger in diameter.
- The clearance holes may want to be counter sunk slightly to allow the heads to come flush with the surface of the piece being fastened. You do this with a counter sink bit in your drill. With 3" screws you will need to be careful to not counter sink too far because your total thickness of two 2x4's is 3" and too deep of countersink will allow the screw to come through on the opposite side.
- Piece being fastened to. This part will need to have pilot holes drilled. The pilot hole diameter needs to be less than the outer thread diameter on the screw but the same size or a tiny bit larger than the inner diameter of the screw thread. This is important because with fat screws like #9's it would be possible to split the lumber.
Additional hints:
a) Rub the threads of the screw on a bar of soft soap and it will make driving them in much easier.
b) Consider using 2.5" screws instead so you have less chance of them going all the way through.
c) Consider using deck screws instead that have an alternate drive slot instead of the Philips. A square drive has much less chance of stripping out when driving large screws.
d) Drill your clearance holes in the piece to be fastened first. Then clamp that piece to the part that it fastens to. This will allow you to use the clearance holes as a guide as to where the pilot holes have to go in the fastened to piece. Make sure the pilot holes are at least as deep as the screw will penetrate. For an inexpensive type 2x4 type frame there really is no problem with drilling the pilot holes all the way through. If the pilot drill bit is not long enough you may have to unclamp the pieces to complete drilling the pilot holes.