Considering that you can get full-sized pickups for that price, or lower, $40k isn't really peanuts. The pricing on some of these mid-sized pickup's and SUV's has gotten a little out of hand.
OP, 2 questions that you need to ask yourself:
1) Is your priority on carrying gear or carrying people? If gear, go with the Tacoma. If people, go with 4runner. Yes Tacoma has different cab options, but rear seats of a 4runner is the better place to be for long trips.
2) Do you hunt frequently? Fish? Outdoor activities that track in mud/dirt? If so, Tacoma makes more sense as you can just throw all the dirty/smelly stuff in the bed and not worry about it. You can get by with a 4runner, but a truck bed just makes that stuff so much more hassle free IMO.
Also, if you are going with a Tacoma, I would strongly recommend getting a mildly used one (pre-2016) to get a mild discount and get more options with how you modify it (supercharger, more established aftermarket).