Manchester City move up to second in the Premier League with a hard-fought victory over Bournemouth at Vitality Stadium.