Rewrite this sentence in a simpler manner: After God speaks to Job and his three friends. God gets very angry at two of Job's friends for thinking that Job was not a good man and for saying things about God they did not know about, and Job prays for his friends: God answers his prayer.
Only after Job's friends make a sacrifice to God and are prayed for by afflicted Job does God restore all Job's good fortune.