The win contradicts an announcement by ZenithOptimedia in August, in which it claimed it had won the business after the retailer's decision to move it out of Bates.
Instead, B&Q has opted to move the media planning account into JWT, which won the creative account in July.
ZenithOptimedia will continue to handle media buying and JWT's WPP sister agency Mediaedge:cia will provide research and other systems support to JWT's planning team, most of whom are said to have joined from Bates.
The win is a coup for WPP, which battled to take the planning business when faced with its loss to arch-rival Publicis, ZenithOptimedia's owner.
B&Q's decision maintains its long-term practice of keeping creative and media planning in the same agency. David Roth, its brand director, decided this was better than housing planning and buying in ZenithOptimedia.
Antony Young, the chief executive of ZenithOptimedia, was unavailable for comment.