Raymond Murphy’s Grammar in Use Intermediate is one of the most comprehensive books around of grammar rules and exercises.  Every student should have this.  There is also Advanced Grammar in Use, and while it is very complete I think it is appropriate for an extremely high level (Cambridge Proficiency Exam).  A good exercise book in between these two is Cambridge Grammar for CAE and Proficiency.