The Red Sox are in the first WC position right now 76-61 (.555 win %). Assuming they finish the year at that percentage they'll win 90 games. Baltimore and Detroit are both 75-62 (.547), pacing to 89 wins.
In the four years since adding the second wild card it has required 93, 92, 88 ans 86 wins.
If I am doing the math correctly, then...
9-4 puts them at 80 wins
8-5 puts them at 79 wins
7-6 puts them at 78 wins
6-7 puts them at 77 wins
I'll ignore 5-8 or worse because I think any such scenario leaves them dead in the water.
The final 16 all come against division foes
7 v. LAA (4H/3A; 11-1 in 2016)
6 v SEA (3 H/3A; 8-5 in 2016)
3 v. OAK (3A; 10-6 in 2016)
So to get to 90 wins, which seems like it should result in a playoff spot, they'll need...
10-6 if starting at 80 wins
11-5 if starting at 79 wins
12-4 if starting at 78 wins
13-3 if starting at 77 wins
The first two of those four feel very "doable." The last two do not feel impossible.
Obviously with the pitching woes going .500+ on the current swing is a tall order, but Baltimore has their own pitching woes, as well as 7 v BOS, and 3 each against TOR and DET. Outside of the 7 v BAL, Boston has 6 v TOR and 7 v NYY, who I don't suspect are going to roll over for their biggest rival. The Tigers have 3 v BAL, 7 v CLE, and 3 v KC (but also 7 v MIN). I really don't see two teams running away from the pack over the next few weeks, so if the Astros can get even serviceable pitching and keep the bats going they have a shot.