DO NOTE: Every migration will lead to SE traffic falling hard at first, before eventually returning back to benchmark positions. It might never return to exactly the same positions as it was.
Clean first. Clean the content, clean the links, remove all the garbage and only take the quality stuff to your domain.
While cleaning the links, make a database of all the links you have control over pointing to your B site.
Once you're done with the migration, you need to go back and manually edit these links, so they point out to the new URLs at site A.
Also, identify the top quality link, you have and if you don't have control over them, find the person who does and email them to change the links pointing to the new URLs at site A
Every content you clean will still have the URLs in all kinds of indexes, hyperlinks and what not. Choose a strategy to redirect these URLs to contextually similar pages on your B site.
Now your B site should have a clean backlink profile and an X number of quality pages.
If it's <100, I suggest you manually transfer the content from B to A. It will take a long time, but will ensure you've looked at every single piece and it's carefully and properly transferred. While doing so, edit ALL your internal linking by pointing the links to your new URL's at site A.
Redirect the B ulr's to A urls. Your homepage should probably redirect to
/BlueWidgetsCategory/ sub page. It can also go to your home, but this way you will show the user exactly what they expect to see when they click a link or visit a page from your B site. (6+ y/o domain will still be visible for a good amount of time, even though it's redirecting every visit to site A, also some people will be purposely visiting site B)
In the A site you need to have to restructure your sitemap.xml instead create a sitemap-index.xml file, which should be an index of all separate sitemaps for each category (e.g. blue-widget-sitemap.xml; red-widget-sitemap.xml ; blog-sitemap.xml etc. etc.)
Here is an example from
Google's site - https://support.google.com/webmasters/answer/75712?hl=en:
Go to your GWT for site A and resubmit the sitemap, also do a "fetch as google" on the
/BlueWidgetsCategory/ landing page
.
Make sure your robots.txt file in site A is allowing bots to crawl everything under
/BlueWidgetsCategory/ so search engines can access the new pages and index them faster, as well as position them to their according places.
When you're done with the migration, try to build some new top quality links towards your
/BlueWidgetsCategory/ page.
This is everything I have on first thought. I'm sure somebody will complete it after me. Also read the links from above, they're very very valuable.