We present a general method for determining the masses and orbital par
ameters of binary millisecond pulsars with long orbital periods (P-orb
much greater than 1 yr), using timing data in the form of pulse frequ
ency derivatives. Our method can be used even when the available timin
g data cover only a small fraction of an orbit, but it requires high-p
recision measurements of up to five successive derivatives of the puls
e frequency. With five derivatives a complete determination of the mas
s and orbital parameters is in principle possible (up to the usual inc
lination factor sin i). With less than five derivatives, only partial
information can be obtained, but significant constraints can sometimes
be placed on, e.g., the mass of the companion. We apply our method to
analyze the properties of the second companion in the PSR B1620-26 tr
iple system. We use the latest timing data for this system, including
a recent detection of the fourth time derivative of the pulse frequenc
y, to constrain the mass and orbital parameters of the second companio
n. We find that all possible solutions have a mass m(2) in the range 2
.4 x 10(-4) M-. less than or equal to m(2) sin i(2) less than or equal
to 1.2 x 10(-2) M-., i.e., almost certainly excluding a second compan
ion of stellar mass and suggesting instead that the system contains a
planet or brown dwarf. To further constrain this system, we have used
preliminary measurements of the secular perturbations of the inner bin
ary. Using Monte Carlo realizations of the triple configuration in thr
ee dimensions, we find the most probable value of in, to be 0.01 +/- 0
.005 M-., corresponding to a distance of 38 +/- 6 AU from the center o
f mass of the inner binary (the errors indicate 80% confidence interva
ls). We also apply our method to analyze the planetary system around P
SR B1257+12, where a distant, giant planet may be present in addition
to the three well-established Earth-mass planets. We find that the sim
plest interpretation of the frequency derivatives implies the presence
of a fourth planet with a mass of similar to 100 M+ in a circular orb
it of radius similar to 40 AU.