I am about 5'8 and a bit under 140 pounds. Am I within the average weight for my height and age?

Yes you are close. It is best to stay close to 140 pounds although you have a little room(up to 145) in case you feel better about gaining a couple of pounds more. In general it is better to avoid gaining because it is much harder to lose it later .