We present phase resolved optical spectroscopy and photometry of V4580 Sagittarii, the optical counterpart to the accretion powered millisecond pulsar SAX J1808.4−3658, obtained during the 2008 September/October outburst. Doppler tomography of the N iiiΛ4640.64 Bowen blend emission line reveals a focused spot of emission at a location consistent with the secondary star. The velocity of this emission occurs at 324 ± 15 km s −1 ; applying a ‘ K -correction’, we find the velocity of the secondary star projected on to the line of sight to be 370 ± 40 km s −1 . Based on existing pulse timing measurements, this constrains the mass ratio of the system to be 0.044 +0.005 −0.004 , and the mass function for the pulsar to be 0.44 +0.16 −0.13 M ⊙ . Combining this mass function with various inclination estimates from other authors, we find no evidence to suggest that the neutron star in SAX J1808.4−3658 is more massive than the canonical value of 1.4 M ⊙ . Our optical light curves exhibit a possible superhump modulation, expected for a system with such a low mass ratio. The equivalent width of the Ca ii H and K interstellar absorption lines suggest that the distance to the source is ∼2.5 kpc. This is consistent with previous distance estimates based on type-I X-ray bursts which assume cosmic abundances of hydrogen, but lower than more recent estimates which assume helium-rich bursts.