Salvation then appears in the form of the Astrologer, who introduces himself as an old aquaintance of Dodon's father. He offers Dodon a golden cockerel which crows a warning in the event of danger: »Beware, be vigilant!« Dodon is delighted when the cockerel instead cries, »Rule from your couch!« As a reward for the golden cockerel, he promises to grant the Astrologer anything he wishes, though he will not confirm it in writing; after all, the Astrologer has the King's word.
Now Dodon can doze in good conscience, beguiled by a lullaby sung by his attendant Amelfa. Suddenly, the cockerel crows: danger is near! Dodon sends his two extremely reluctant sons off to war, but what bothers him most is being woken from his dreams. When he challenges Amelfa to guess what he has been dreaming, she soon surmises correctly that a beautiful woman was involved. Once again, the cockerel's crow signals imminent danger. Polkan explains to the King that this time, all the old men must go to war. Dodon unwillingly sets off as well.
Dodon mourns the death of his two sons, who did not fall in combat however – but rather killed each other. He then discovers the reason why: he encounters the mysterious Queen of Shemakha, who so bewitched both men that they killed each other out of jealousy. Before long, the Queen has Dodon under her spell, too. She even tells him to his face that she will rob him of his kingdom – without any army and solely with the aid of her beauty. Nevertheless, the infatuated King is happy to sing and dance for her, and doesn't realise he is making himself ridiculous. Completely captivated by her, he tells the Queen that he and his kingdom now belong to her. When she says she wishes the sceptical Polkan to be punished for his opposition, Dodon proposes having the general's head cut off. The Queen's retinue laugh at the doting old King.
The people are uneasy. Since the golden cockerel hasn't crowed for a long time, there is presumably no danger, but nobody knows what has happened in the meantime. In the King's absence, Amelfa has become a haughty despot. She pretends to know more than the others – that the King has defeated a dragon and rescued a princess, who he is bringing home as his bride; and he had to have his sons executed, she says. When Dodon appears with the Queen and her retinue, the Astrologer suddenly emerges from the crowd and declares he would now like to claim his reward for the golden cockerel: the Queen of Shemakha. Indignant, the King refuses and offers him other gifts instead. The Astrologer does not back down and Dodon strikes him dead. The Queen turns away from him full of contempt; the golden cockerel then swoops on him and kills him. The people are forlorn and fear what the future holds without the good King.
The Astrologer enters once more and reminds the audience that it was all just a fairy tale. The only real people, he says, were himself and the Queen of Shemakha …