Make sure you have graduated, so you are no longer a student, and there can be no perceived connection between the gift and your grades. You want the gift to be outside university rules.
University teachers often are not well paid. How shabby are his clothes and car? The reason I ask is this: If you take the teacher and his wife out to dinner, they may have to hire a babysitter, which may be expensive for them.
Lunch is usually ideal. It has the significance of a meal, without the cultural connotated social pressure of dinner. It also does not interfere with his family time, which may be precious to his family.
If the gift is not so expensive, (Maybe $20) but more symbolic, then you may give it earlier in the meal. The advisor will likely not want to talk about the gift very much. If it is more expensive, ($50-100) then give it to him as you say good bye, and ask him to open it later, so he will not open it in front of you. This way he can be much more comfortable during your meal together.
Do not give an extremely expensive gift. Honestly, a used book with a short note explaining why you love the book would feel like a significant gift to the teacher, even if the book only cost you $2. Cherished books are much more valuable than their price tag. University teachers often are not well paid. How shabby are his clothes and car? The reason I ask is this: If you take the teacher and his wife out to dinner, they have to hire a babysitter, which may be difficult for them.
If you are from another country, you could give something from your homeland. (That might end up being more expensive, but because it is a cross-cultural gift, you can get away with something higher. Your university may have rules regarding the value of a gift, so please protect your advisor from professional difficulty. My husband used to teach at the university. and I teach now. Our experience is that the international students tend to give more expensive gifts, (a fancy pen, a large hand painted scroll, a small teapot) so even though they were sometimes costlier than we would have been comfortable with, we recognized this was a cultural difference and were humbly grateful for the respect and appreciation the student was clearly expressing.
Here is a thought: You can tell/write to him "I would really like to take you out to lunch or dinner this next week to thank you for all you have done. What is your schedule like? How would Tuesday or Wednesday work for you?" He will probably say it isn't necessary. If you tell him again that you would really like to do this, he will probably accept. But by asking him which is better for him he can chose the situation that can fit with his family's needs.