Toasts for a 40th birthday can either be funny or they can be serious and sentimental. The direction of the toast is determined by the person giving the toast and their relationship with the person who is having their 40th birthday.
The toast may include tales of how they have changed and grown up over the years. The toast should also include admirable traits and personality traits of the loved one who is having their 40th birthday.
The age range of the party guests should be considered as well. Off-color jokes are acceptable for an age group in the 40s but jokes should be censored if there are young children attending the party. Knowing the audience will help figure out what kind of toast should be used as well. If people in the audience generally don't like verbose toasts, it's better to go with something more sentimental.
The toast doesn't need to be long, simply something like "Today I offer my very best wishes to one of the best persons I know, who is like a best friend to me. Together, we have experienced some of the best possible times in my life. Here's raising a toast for your Happy Birthday!"