In exchange for Williams' services and Dallas' seventh-round draft choice in 2009, the Lions will receive Dallas' first, third and sixth picks in next year's draft.
Williams, a fifth-year receiver out of Texas, has 262 receptions for 3,884 yards with 29 touchdowns in 60 career games.
"We didn't get this trade done until about two minutes left on the clock, on the NFL trade deadline," said Cowboys owner Jerry Jones.
The Cowboys announced that Williams, 26, has come to terms on a five-year contract extension. This season, he has 17 receptions for 232 yards and a touchdown.
The Cowboys now have two players named Roy Williams on their roster. The other is a veteran safety, who was a first-round pick of the team in 2002.
2014: The Year in Fashion [PHOTOS]
LeBron James reveals his new Nike shoes