Place a complete bed using /setblock

Solution 1:

You'll need to use two commands; one to set the foot part, one to set the head part. To setblock the head part of the bed, add 8 to the dataValue you used for the foot part.

For example, these two commands will create a bed facing north:

/setblock 0 64 0 bed 0
/setblock 0 64 1 bed 8

Or these two for a bed facing east:

/setblock 0 64 0 bed 3
/setblock 1 64 0 bed 11