Short answer, there is a health risk from increased intake of polluted air, but the health benefits outweigh the risk. Funnily enough, you are exposed to a higher concentration of pollutants driving, but for a shorter amount of time and at a lower respiratory rate.
Overall, air pollution exposures experienced by car drivers were modestly higher than those experienced by cyclists, with mean ratios of 1.16 for PM2.5, 1.01 for UFP, and 1.65 for elemental carbon or soot. However, increased physical activity results in higher minute ventilation (volume of air inhaled in one minute) for cyclists than for car drivers, with estimates from two Dutch studies reporting that the minute ventilation of cyclists was 2.3 times (van Wijnen et al. 1995) and 2.1 times (Zuurbier et al. 2009) higher than that of car drivers. Therefore, inhaled doses of PM2.5 and, to a lesser extent, elemental carbon may be higher in cyclists.
More worrying is the potential increase in mortality due to accidents.
These data suggest that there are about 5.5 times more traffic deaths per kilometer traveled by bicycle than by car for all ages, and that cycling is riskier than travel by car for all age groups except young adults (15–30 years of age), with about 9 times more deaths among those < 15 years of age, and 17 times more deaths among those > 80 years of age.
Still, it's overall worthwhile if you're willing to put the effort into it.
The estimated gain in life expectancy per person from an increase in physical activity ranged from 3 to 14 months (Table 6). The estimated life expectancy lost because of air pollution (0.8–40 days) and traffic accidents (5–9 days) was much smaller. On average, the benefits of cycling were about 9 times larger than the risks of cycling, compared with car driving for the individuals making the shift, calculated as 337,896/(28,135 + 9,639). The estimated number of life years gained still exceeded the losses when the lowest estimate for physical activity was compared with the highest estimate for air pollution and traffic accidents (benefits/risks ratio of 2).
On a slightly more worrying note, you can find the short-term results of exposure mentioned in Is there any scientific info about effects of air pollution during exercise? where it's been found that, immediately after exercise, results of cognition tests may be lower due to inhaled pollution although the results are more a comparison of joggers in the country versus joggers in the city, and seem to be about short-term effects.