Terms of the contract weren't released although a Stanford release described the extension as "long-term."
Shaw, 40, is in his second season as the Stanford head coach. The Cardinal have gone 11-2 overall and 8-1 in the Pac-12 Conference each season. Stanford, ranked No. 8, defeated UCLA 27-24 in the Pac-12 Championship game this year and advanced to the Rose Bowl against Big Ten champion Wisconsin.
"David has demonstrated great success as a leader within the Stanford community and as a mentor to scholar-athletes who wear the Cardinal uniform," Stanford Athletic Director Bernard Muir said in a statement.
"This agreement provides added stability and reassurance that David will be at the helm to secure our football program's long-term sustained success."
Shaw, who also played collegiately at Stanford, was offensive coordinator for the Cardinal for four seasons. He's also had coaching positions with the Philadelphia Eagles, Oakland Raiders and Baltimore Ravens in the NFL.