Peter was in prison, fastened with two chains, between two soldiers. An angel came. His chains fell off. Peter and the angel passed two guard posts. When they came to the iron gate, it opened all by itself (see Acts 12:6-17).
God did this.
But his friends did their part: While Peter was in prison, the church prayed very earnestly for him. . . many were gathered for prayer (Acts 12:5,12).