Peter slept well because:
1 - Peter knew his friends were praying for him
2 - Peter knew he had done nothing wrong and had a clear conscience - God gives rest to those with a clear conscience. Ask god (Ps 51)
3 - Jesus himself had given peace to Peter. "My peace I give to you. Not as the world gives." phil 4:8

Acts 12:6