William, allied with the Hooks, was in conflict with his father until 1394. In 1404 he succeeded him as Count of Holland, Zeeland and Hainaut and duke of Bavaria-Straubing.
In 1408 in the Battle of Othée William and John of Burgundy defeated together with Louis VII, Duke of Bavaria the citizens of Liege who revolted against William's brother John of Bavaria, the bishop of Liège. As a result, he was no longer, as count of Hainaut, obliged to pay homage to the bishop. William's reign was marked by internal strife within the county of Holland. In particular, Lord John V of Arkel supported William's enemies in Holland. William conquered Arkel in 1412, at which point John accepted his defeat and Arkel was annexed by Holland.
William claimed Friesland as the count of Holland. Duke William I of Bavaria-Straubing had previously sent five expeditions to conquer Friesland. Only Stavoren was captured in 1398. William II also sent expeditions to the region but Stavoren was regained by the Frisians in 1414. Prior to his death, William ensured his nobles swore allegiance to his only daughter, Jacqueline. Jacqueline was the only child by his wife Margaret of Burgundy, a daughter of Philip the Bold whom he married in 1385, at the Burgundian double wedding in Cambrai, at the same time his sister, Margaret of Bavaria, married John the Fearless.
However, on William's death in 1417, a war of succession broke out between his brother John, the bishop of Liège and his daughter Jacqueline of Hainaut. This would be the last episode of the Hook and Cod wars and finally place Holland and Hainaut into Burgundian hands. The duchy of Bavaria-Straubing was divided between the dukes of Bavaria, the major portion went to Bavaria-Munich in 1429.