Joshua Commands the Sun To Stand Still
1 King Adonizedek of Jerusalem heard that Joshua had captured and destroyed the town of Ai, and then killed its king as he had done at Jericho. He also learned that the Gibeonites had signed a peace treaty with Israel. 2 This frightened Adonizedek and his people. They knew that Gibeon was a large town, as big as the towns that had kings, and even bigger than the town of Ai had been. And all of the men of Gibeon were warriors. 3 So Adonizedek sent messages to the kings of four other towns: King Hoham of Hebron, King Piram of Jarmuth, King Japhia of Lachish, and King Debir of Eglon. The messages said, 4 “The Gibeonites have signed a peace treaty with Joshua and the Israelites. Come and help me attack Gibeon!”
5 When these five Amorite kings called their armies together and attacked Gibeon, 6 the Gibeonites sent a message to the Israelite camp at Gilgal: “Joshua, please come and rescue us! The Amorite kings from the hill country have joined together and are attacking us. We are your servants, so don't let us down. Please hurry!”
7 Joshua and his army, including his best warriors, left Gilgal. 8 “Joshua,” the Lord said, “don't be afraid of the Amorites. They will run away when you attack, and I will help you defeat them.”
9 Joshua marched all night from Gilgal to Gibeon and made a surprise attack on the Amorite camp. 10 The Lord made the enemy panic, and the Israelites started killing them right and left. They chased the Amorite troops up the road to Beth-Horon and kept on killing them, until they reached the towns of Azekah and Makkedah. 11 And while these troops were going down through Beth-Horon Pass, the Lord made huge hailstones fall on them all the way to Azekah. More of the enemy soldiers died from the hail than from the Israelite weapons.
12-13 The Lord was helping the Israelites defeat the Amorites that day. So about noon, Joshua prayed to the Lord loud enough for the Israelites to hear:

“Our Lord, make the sun stop
in the sky over Gibeon,
and the moon stand still
over Aijalon Valley.”
So the sun and the moon
stopped and stood still
until Israel defeated its enemies.

This poem can be found in The Book of Jashar. The sun stood still and didn't go down for about a whole day. 14 Never before and never since has the Lord done anything like that for someone who prayed. The Lord was really fighting for Israel.
15 After the battle, Joshua and the Israelites went back to their camp at Gilgal.
Joshua Kills the Five Enemy Kings
16 While the enemy soldiers were running from the Israelites, the five enemy kings ran away and hid in a cave near Makkedah. 17 Joshua's soldiers told him, “The five kings have been found in a cave near Makkedah.”
18 Joshua answered, “Roll some big stones over the mouth of the cave and leave a few soldiers to guard it. 19 But you and everyone else must keep going after the enemy troops, because they will be safe if they reach their walled towns. Don't let them get away! The Lord our God is helping us get rid of them.” 20 So Joshua and the Israelites almost wiped out the enemy soldiers. Only a few safely reached their walled towns.
21 The Israelite army returned to their camp at Makkedah, where Joshua was waiting for them. No one around there dared say anything bad about the Israelites. 22 Joshua told his soldiers, “Now, move the rocks from the entrance to the cave and bring those five kings to me.”
23 The soldiers opened the entrance to the cave and brought out the kings of Jerusalem, Hebron, Jarmuth, Lachish, and Eglon. 24 After Joshua had called the army together, he forced the five kings to lie down on the ground. Then he called his officers forward and told them, “You fought these kings along with me, so put your feet on their necks.” The officers did this, 25 and Joshua continued, “Don't ever be afraid or discouraged. Be brave and strong. This is what the Lord will do to all your enemies.”
26 Joshua killed the five kings and told his men to hang each body on a tree. Then at sunset 27 he told some of his troops, “Take the bodies down and throw them into the cave where the kings were found. Cover the entrance to the cave with big rocks.”
Joshua's troops obeyed his orders, and those rocks are still there.
Joshua Continues the Fighting
28 Later that day, Joshua captured Makkedah and killed its king and everyone else in the town, just as he had done at Jericho.
29 Joshua and his army left Makkedah and attacked the town of Libnah. 30 The Lord let them capture the town and its king, and they killed the king and everyone else, just as they had done at Jericho.
31 Joshua then led his army to Lachish, and they set up camp around the town. They attacked, 32 and the next day the Lord let them capture the town. They killed everyone, as they had done at Libnah. 33 King Horam of Gezer arrived to help Lachish, but Joshua and his troops attacked and destroyed him and his army.
34 From Lachish, Joshua took his troops to Eglon, where they set up camp surrounding the town. They attacked, 35 captured it that same day, then killed everyone, as they had done at Lachish.
36 Joshua and his army left Eglon and attacked Hebron. 37 They captured the town and the nearby villages, then killed everyone, including the king. They destroyed Hebron in the same way they had destroyed Eglon.
38 Joshua and the Israelite army turned and attacked Debir. 39 They captured the town, and its nearby villages. Then they destroyed Debir and killed its king, together with everyone else, just as they had done with Hebron and Libnah.
40 Joshua captured towns everywhere in the land: In the central hill country and the foothills to the west, in the Southern Desert and the region that slopes down toward the Dead Sea. Whenever he captured a town, he would kill the king and everyone else, as the Lord God of Israel had commanded. 41 Joshua wiped out towns from Kadesh-Barnea to Gaza, everywhere in the region of Goshen, and as far north as Gibeon. 42-43 The Lord fought on Israel's side, so Joshua and the Israelite army were able to capture these kings and take their land. They fought one battle after another, then they went back to their camp at Gilgal after capturing all that land.